query take long time

  • hai

    i have two table . the name of Mt and  win. the mt table have 26,00,000 record . the win table have 56,000 record.

    the mt table field is ID, username , password ,iP address

    the   win table field is ID, UrlDetails,status,

    the UrlDetails values is   username+ password+ iP address (mixed of the 3 values) 

    my query is

    SELECT    status  FROM         win  WHERE     EXISTS

                   (SELECT     iP address  FROM        MT                            WHERE      ((UrlDetails LIKE '%IP%'))                  

    the query take long time 20 hours. how is reduce time pls advice  me

    with reagrds

    kumar

     

     

  • Create a temporary table that holds the extracted IP Address from MT then do an inner join between status and your temp table

  • any sarg that uses a leading % will have to table scan which is very expensive. Do you need the leading % ?

    [font="Comic Sans MS"]The GrumpyOldDBA[/font]
    www.grumpyolddba.co.uk
    http://sqlblogcasts.com/blogs/grumpyolddba/

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply