Click here to Skip to main content
15,899,124 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using SQLite as Database for my WPF application, need to load Large amount of data from Database, When I use select * from tablename to load data it is taking long time. Can any one help me to fetch the data as fast as?

What I have tried:

I used normal Select query to fetch data from SQLite DB
Posted
Updated 24-Mar-17 23:28pm
Comments
Richard MacCutchan 25-Mar-17 5:31am    
Do not fetch all the data at one time, it is just a waste of resources.

1 solution

It's going to depend on how you are loading it, and what you are doing with it once loaded.
If you use a DataAdapter, then the command execution does not return until the DataTable or DataSet is completely loaded - with large amounts of data this can take quite a while.
If you use a DataReader, the command execution returns almost immediately, but each row must then be accessed sequentially and each access takes a little longer than accessing the same data from a DataTable.

If you are processing rows one-by-one, then a DataReader may be a better choice as control is returned immediately. If you are loading a DataTable so that you can dump a huge amount of data into a UI control, then you are causing your own problem and creating an app that is always going to be slow, and hated by your users.
We can't tell.

It's also possible that your data includes large objects that you don't use: SELECT * returns everything, so if a column contains images that you don't need, you can probably speed things up by specifying only the columns you do need - this is considered a good practice anyway.

But basically, it's up to you: we have no idea how you fetch your data, how much of it there is, or what you do with it when you have fetched it - and we can't look at your app or data to find out!
 
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