SQL Server Performance

AVOID REPEATED SELECT ON SAME TABLE

Discussion in 'ALL SQL SERVER QUESTIONS' started by SOUBIN S, Jan 15, 2012.

  1. SOUBIN S New Member

    Hi,
    I have to perform select statement on table dbo.test,which is having data aroung 4000 records.And i need to perform the select statemnt around 8 times in my SP with differenct conditions and need to insert the 8 differenct record set to 8 different tales.Can you please provide solutions to my doubt
    May i need to temporary store data in SP,or its better to perform the select statemnt 8 times on the table (dbo.test) itself
    If its better to store temporary in my SP, Which method will be efficient (using temp table or table variable or any other method)
    Thanks in advance
  2. FrankKalis Moderator

    Welcome to the forum!
    With just 4.000 records in the table it sounds as if you don't need to go for any fancy sophisticated approach. If this however is a busy table with lots of modifications, you might indeed find it beneficial to dump the data into a temp table first and then only operate on this temp table without touching the base table. I would build up a small test scenario to see which approach is better in your environment. Creating the temp table and copying the data into it, are just a few extra lines of code that could be well worth it.
  3. SOUBIN S New Member

    Thanks for the reply.I reached at the conclusion that for 4K records, there is no use of storing data temporarily.
    So Can you please tell me for what amount of data we need to take care about the temporary storing..
    The 8 select condition are based on same column only (category).But we are loading to 8 different target table having different column names and all.

Share This Page