THE SQL Server Blog Spot on the Web
Welcome to SQLblog.com - The SQL Server blog spot on the web Sign in | Join | Help
in Search

retrieve records from huge table

Last post 11-30-2008, 18:05 by jAuer. 4 replies.
Sort Posts: Previous Next
  •  11-25-2008, 13:11 10114

    retrieve records from huge table

    hi,

      i am new member of the site.

         In my project archive table have lakh  of records in last  5 years , i am using full index for keyword search, but date wise search ( 1 year )  without keyword taking more time . my application in .net technology time out expire problem i am facing .

     

         any solution , kindly give to me

     

           

  •  11-25-2008, 16:13 10115 in reply to 10114

    Re: retrieve records from huge table

    What means 'huge table'?

    Has the table a primary key?

    What's your search query?


    CRM - Online - Solutions

    Sql (german)
  •  11-27-2008, 5:48 10139 in reply to 10115

    Re: retrieve records from huge table

    hi jAuer,

                  thanks for reply. i  mean    more than 8 lakh or lac records available in that table , no primary key ,  but have unique key field

     

      like , 

            select column1 , column2 from table_archives where  convert(nvarchar(10),  dateon ,112)>= '20021002'  and convert(nvarchar(10),  dateon ,112)<= '20030402'

    dateon  datatype is datetime

    retrieve  2lac records. it take more time  so  front end (asp.net) connection time out error occurs.

      Regards,

      Karthikeyan

       

     

  •  11-28-2008, 4:52 10164 in reply to 10139

    Re: retrieve records from huge table

    Hi Karthikeyan,

    Remove your CONVERTs, the one on the left-hand side will cause your index to be scanned. Bear in mind that if you return closer to 10% of the rows, the optimizer will probably opt for a scan anyway.

    Use the following SET statements to investigate the query plan and the number of IOs (assuming you are not on a production server, use DBCC FREEPROCCACHE to clear the procedure cache between your runs).

     SET STATISTICS PROFILE ON

    SET STATISTCIS IO ON

     -- your query goes here

    DBCC FREEPROCCACHE

    HTH

    /Elisabeth


    Elisabeth Rédei | www.sqlserverland.com | MCITP, MCT | http://www.linkedin.com/elisabethredei
  •  11-30-2008, 18:05 10204 in reply to 10139

    Re: retrieve records from huge table

    Add a primary key. The PK is used in indexes.

    Change your query: Put the date into a variable and use something like

    Where dateon Between @startdate And @enddate

    I hope there is an index on the column dateon.


    CRM - Online - Solutions

    Sql (german)
Powered by Community Server (Commercial Edition), by Telligent Systems
  Privacy Statement