Of course this metadata-level cardinality may be generated daily and hence may not be current, but for the purposes of paging it's probably entirely sufficient unless you expect a user to walk through many, many pages of data.
On 6/29/07, Scott Swank <[EMAIL PROTECTED]> wrote: > Any modern database uses a "cost-based optimizer" to determine its > query execution plans. This means that at a minimum the database > knows how many rows each table contains. This means that you just > have to find this metadata -- then you can use that in lieu an actual > count(*). > > On oracle you would: > > select num_rows > from all_tables > where owner = 'FOO' > and table_name = 'BAR'; > > instead of > > select count(*) > from foo.bar > > > On 6/29/07, "C. Bergström" <[EMAIL PROTECTED]> wrote: > > Gwyn Evans wrote: > > > Hi, > > > > > > Anyone got any suggestions as to the best way to provide a paging > > > data view without requiring using size() to actually count the records > > > in DB? > > > > > > I've got a site that has a production DB such that > > > "select COUNT(*) from mytable" > > > takes a non-trivial amount of time/cpu to return, whereas to get > > > the actual data for the page is effectively immediate! > > > > > > I'm curently using a DefaultDataTable and the quick hack is to just > > > hard-code DataProvider.size() to just return a fixed number, but while > > > that's probably OK, it's sub-optimal (it is just a util for my own > > > use though, really). Having said that, I'd be interested in > > > alternative suggestions. > > > > > > It's the Production DB only that shows this behaviour (which is > > > probably related to them not purging the the old data for 4 years or > > > so, so I'm limited as to what might be possible with the DB itself). > > > > > I smell Postgres and just going to go out on a limb here.. :) triggers > > that update a counts table, db maintenance, or search the postgres > > "perform" archive for other ways to achieve this.. I'm pretty sure I see > > this question nearly every two weeks and from what I've read and > > remember it pretty much falls on the responsibility of the backend. > > There's also certainly more commentary in the wicket-users archives as well. > > > > Good luck, > > > > ./C ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user