Fill a List with Large Amount of Data – Part 1

In my opinion, making database queries in separate threads in order to avoid UI blocking is the last option a Windows developer should have. Of course, that’s an option like any others but, to avoid headaches of thread synchronization and so on, we have to consider first the following:

  • 1. Optimize the database, index fields if necessary.
  • 2. Choose the right database access technology.

Well, let’s say we are just “poor developers” and both database designer and project manager are idiots. Then, there’s no choice and we have to live with them without resolving #1 and #2. In most cases, UI is blocked as a result of populating a list control with a large number of rows, from a recordset. Have we to make this in a separate thread? Not really, wait a minute!

  • 3. Use a virtual list. A virtual list does not keep the UI busy until it’s filled with thousands, tens of thousands or even hundreds of thousands items. It just asks info about items which have to be currently displayed.
  • 4. Not enough? We have to deal with queries which return millions, tens of millions or even more results? No problem, can use a cache mechanism.

Both #3 and #4 are supported in the Windows common listview (SysListView32) control.

See also

1 thought on “Fill a List with Large Amount of Data – Part 1”

  1. I can hardly wait the forwarding parts, because I did not see this subject described in detail …


Leave a Comment