RE: [PHP-GTK] GtkListStore and Sql tables

From: Date: Tue, 21 Feb 2006 22:38:34 +0000
Subject: RE: [PHP-GTK] GtkListStore and Sql tables
References: 1  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-6769@lists.php.net to get a copy of this message
Hi Christian, i have not played around with MySQL results in a GtkList, but a lot with MySQL sortings themselves and speed. > Now one idea would be to get the number of rows from the > table and create dummy rows in the store. Then I'd write my > own cell data func, and whenever a unloaded row occurs, a > query is made. That would be real on-demand loading. > Disadvantage of that approach is that thousands of single > queries are made when the list is sorted or searched. I would rather suggest, that you build an internal list of e.g. 700 results and you fill in the data into the list on scrolling. Means you keep always ONLY the visible entries (could be a resizing prob :-/ ) and change the data on a scroll event. If you reach the limit you have in memory, you move your internal list by 350 forward. > So it seems as if loading all is required, or provide > "previous" and "next" buttons like in phpmyadmin. > Any thoughts on this subject? Did I miss an obvious solution? > Does somebody has experience with this problem? Loading all is not suggested, you can count the expected amount with $amount_of_rows = mysql_num_rows($myresultset); That works quite fast with my ca. 1 million products on tradebit. If you start to sort, though, the whole thing slows down, even with indices ... I needed to work heavily with LIMIT $start,$amount on the larger tables. As soon as you introduce ORDER BY it could get slow, but not with 20k results, rather >200k! My 2 pennies, Ralf Schwoebel http://www.tradebit.com/

« previous php.gtk.general (#6769) next »