Click here to Skip to main content
15,919,423 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
In my project i have 20000 records in one table.
if i run the table i get more time to retrieving the date


Any Possible to retrieve the date quickly from the database


What I have tried:

select * from table_name

it takes more than 20 seconds to retrieving date from database
Posted

jgakenhe makes very good points - but start by looking at the data you are retrieving. I can fetch 21024 rows from my SQL Server table in under a second, purely because the volume of data I am retrieving is trivial: 1 int ID, and 1 NVARCHAR(260) is all. So look at what you are fetching, and at the speed of the link between the SQL server PC and the client

Then look at exactly what you are doing with the data: if you are trying to load that into a display control of any form, then that is always going to be a slow process.

Sorry, but we can't wave a wand and say "It's this line: change it to such-and-such" because there are just so many different things you could be doing to slow down the data.
But me? I don't fetch any more rows or columns than I need at the moment - it's always going to be data traffic intensive.
 
Share this answer
 
Comments
V Senthil Kumar 6-Feb-16 4:24am    
What Can I do now.. Can u explain briefly...
OriginalGriff 6-Feb-16 4:33am    
:laugh:
We can't say: "there are just so many different things you could be doing to slow down the data."
And remember that we can't see your screen, access your HDD, or read your mind - let alone access your data!
So start from the beginning, and explain exactly what you are doing.
It's going to be slow, that is a lot of records to return.

1) Make sure you have a primary key.
2) Return only the rows you need; meaning filter by the primary key or another column.
3) Select only columns you need. If you have big columns you don't need, then don't include in your query; such as: image, varchar(max), ect...

Also, you should not typically need to return 20000 records. 20000 records will bring down a web browser and will print to 100's of PDF pages.
 
Share this answer
 
Comments
V Senthil Kumar 6-Feb-16 4:25am    
Thanks:-)I wont need pdf..I want just to view

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