I finally had a chance to test out Vivien Malerba’s cursor support in libgda, and fixed some problems. It lets you use the “ITER_MODEL_ONLY” parameter to get a GdaDataModel that should be used only via a GdaDataModelIter iterator. That uses the SQL “FETCH” command to get chunks of rows at a time instead of getting all the rows even if you are only interested in a few of them. I added an example of this to libgdamm.
For instance, Glom won’t cause libgda to get all one million records to show you a list of all records if the GtkTreeView only has space to show ten at a time. However, I’m not sure if it will get all the intermediate data when someone moves the scrollbar quickly from row 1 to row 500,000, because of this comment in the PostgreSQL documentation for FETCH. I’d like to avoid hacking on Postgres to fix that.
"ABSOLUTE fetches are not any faster than navigating to the desired row with a relative move: the underlying implementation must traverse all the intermediate rows anyway.”
So far this is only implemented for libgda’s PostgreSQL provider. It would be great if people could implement it for the other providers. The “FETCH” command seems to be fairly standard SQL, so it should be easy.