I have a program that needs information from a database but it doesn’t need all of the information at once, although it WILL need it at some point. Would it be better to pull all of the information from the database right away and use it as needed or to pull the information from the database as needed?
1
It depends.
If you know you will need all the data eventually, it is technically faster to download it all at once.
However, if you can download a portion of the data and use it to keep the user busy (rather than making him wait for the last byte to arrive) while you download the rest either in the background or on an as-needed basis, your application will be perceived to be quicker.
The short answer is that there is no hard and fast rule – you’ll have to do some testing to determine what best fits your particular situation.
3