Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I have got a table with 26 columns and about 1 million records in it, when I select all records from database in sql management it takes about 26 sec and it is so much,I have used clustered index in table ,my system config is :4 GB Ram,and processor:2.66 GH,and 32 bit operating system, so question is why loading of 1 million is so slow , I do not think 1 million records are so much for sql server 2005, is it related to my hardware such as RAM or CPU ? if yes so how much RAM is necessary for it? thanks.
Posted
Comments
Shweta N Mishra 25-Nov-14 3:35am    
Why you want to show 1 million of record in SQL Management ? Loading / Viewing such records obviously will take some time.

It has been mentioned and covered a bunch of times that having a huge data in your database would take a lot of time to be extracted! 1 million records, 26 seconds are fair. There are two ways to move, one is if you've got a lot of money to spare (and waste... yes, waste). Other way is to use your wit and cut short this query.

First method - Go to nearest (or farthest) store for hardware stuff, buy a lot of RAM, a new CPU or should I say a mainframe at all. Then use it!

Second method - I would go with this approach, in this approach, what you will do is you will add a new constraint in the query as TOP 100 so the query would be like this

SQL
SELECT TOP 100 * from ...


What would this do? This would select the first 100 records in the table, making it faster to be executed and returned to your application for rendering as a table and other stuff that you want to do with those results, usually display.

How will this help? Have you tried reading the records in the table? There are only a few records shown at a time, mostly I've shown only 20 records to the users at a time, no user would have a look at 1 million records in just an instance of time. You would show him the first 100, then if he wants he can request for the next 100 and so on and so forth. This would be better, suppose a user has a pentium 4 computer with 1GB RAM he would leave your website if you send him this much data to process and render. Consider sending less data, then if he wants to read, send him the next data and so on. No user is interested in reading all of the records that you're having, he wants to know about those which are relative to him - his own record specially.
 
Share this answer
 
Other way to get the records faster is to get the result of your query to a text file instead of grid. Which will process must faster and then you can read from that file.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900