Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Option Exists ?

Author  Topic 

Johnny1985
Starting Member

26 Posts

Posted - 2007-06-05 : 13:41:09
Hello,

I managed to BULK INSERT over 500 million lines to my DB.
Now, I want to lookup the last value.
Standard "SELECT * FROM X WHERE ..." query takes too much time (surprisingly ....), and so my with is to either increase the timeout interval (I already changed it to 0 in main server), or to quick search the DB.
Indexing would take forever in this case (literally millions of lines).

Is there any T-SQL query that performs better ?
(I'm totally new to DB servers so excuse me for the stupidity ..)

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2007-06-05 : 13:52:02
quote:
Is there any T-SQL query that performs better ?


You mean without having to add indexes? I dont think so..
Perhaps you can make it part of your migration process to add indexes after the BULK INSERT. It might take couple of hours for the indexes but at least your queries will be faster.



Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

Johnny1985
Starting Member

26 Posts

Posted - 2007-06-05 : 14:01:06
Adding indexers to my table will take extra HD space ?
If my table takes 20GB, how much do you think will be added ?
Go to Top of Page

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2007-06-05 : 14:37:38
It depends on how many indexes you add. Start with the columns in the WHERE condition for the query most used.

Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page
   

- Advertisement -