views:

1191

answers:

6

Large datasets, millions of records, need special programming to maintain speed in DBGrids.

I want to know if there are any ready-made components for Delphi (DBGrids) that do this automatically?

EDIT For Example: Some databases have features such as fetch 1st X records (eg 100 records). When I reach the bottom with scrolling, I want to auto fetch the next 100. Conversely when I reach the beginning, I want to fetch the previous 100. I know I can program this, but it sure is possible to propagate that feature to a DBGrid control where the DBGrid does the buffering. It will save quite a bit of programming - you simply have to set the "buffer size" so to speak.

+1  A: 

What you need to do with that amount of records in memory?
Memory and Speed problems are sure.

You must filter, sort, group,... (minimize the result count) BEFORE visualize the results in a DBGrid.
It's useless see 1 million of records in a DBGrid. I think that it's a design error.

Can you explain more in detail what you need?

Excuse-me for my bad english.


Neftalí

Neftalí
Thanks for the answer, but I do not want to keep the million in memory - please see my edit.
mm2010
+2  A: 

NextGrid is light, fast and nice looking grid for Delphi

http://www.bergsoft.net/component/next-grid/features.htm

HANDLING LARGE AMOUNT OF CELLS WITHOUT LOOSING SPEED

NextGrid can handle very large amount of cells without losing speed. Speed of adding, modifying and deleting data doesn't depend of the amount of cells. In NextGrid demo you can see how fast NextGrid work with 100,000 rows and 10 columns = 1,000,000 cells

Mohammed Nasman
A: 

sorry, I just saw your comment to Neftalí

if you would to bring 100 record per time, and then fetch the next 100, this work related to database access components, look at devart components, they are offer direct access components to most used database, and they have the feature you are asking about and more:

http://www.devart.com/products-vcl.html

Mohammed Nasman
I want the DBGRid to do the buffering
mm2010
+2  A: 

I think the DevExpress Quantumgrid supports this very good.

birger
+3  A: 

I would have a look at Developer Express QuantumGrid Suite. (@birger: you just were a tick faster ;-) ) So I'm not just duplicating the answer, some elaboration:

The DevExpress Grid uses a data controller that has several modes to controll the data bound to the grid. One of these is exactly what you are looking for:

Grid Mode

When using Grid Mode, only a fixed number of dataset records is loaded into memory. Because only a limited set of records are retrieved from the dataset, automatic sorting, filtering and summary calculations are disabled in Grid Mode (must be controlled manually instead). By default, this mode is disabled and the ExpressDataController loads all records in a dataset.

It does have some drawbacks, which seem pretty obvious: you cannot make a summary, sort, or filter if you do not have all records at hand.

Ralph Rickenbach
Thanks for this info, hard to come by via Google. :)
mm2010
+2  A: 

You might want to take a look at the wonderful (free, open source, dual licensed as MPL 1.1 and GPL thus usable in closed source apps) Virtual TreeView and its user-supplied descendants (scroll down the page to find those.)

Edit to reflect the question's edit: Virtual TreeView not only allows you to handle millions of nodes without keeping them in memory, but that is in fact the preferred way of using it. You supply the data through event callbacks when it's needed, and you can tell the tree to cache that data (or not.)

Oh, and of course it also has a grid / report mode where it can function as a table (just set the GridExtensions property to True.)

Mihai Limbășan