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 2000 Forums
 Transact-SQL (2000)
 Retrieving large amount of Records Using order by NEWID()

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-04-19 : 10:58:47
C.K.Singh writes "<u>Configuration</u>

I'm using MSSQL 2000 on Windows 2000 platform.The configuration is PIV - 1.6 GHz with 256 SDRAM. The database is on another Database server.


<u>Problem</u>

I'm able to retrieve 10 lacs of random records out of around 60 million records using the "order by newid()". But the problem is that it takes lots of time. Is there any better solution to retrieve the random records so that the time of retrieving the large amount of recordset can be minimised.

"

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2004-04-19 : 11:35:50
Don't use "SELECT *"...use "SELECT col1, col2, etc".....
which is a good SQL habit anyway....for performance and also for knowing exactly what a SP/SQL statement returns...(without having to refer to the table structures for the latest list of fields)


Anyway looking for 10,000 records out of 60,000,000 will mean that 60,000,000 will have to be read the 1st place!....that'll take time!
Go to Top of Page
   

- Advertisement -