>> > If you are not interested in using the modules, it is not actually
that
>> hard
>> > to roll your own. In the past I have done different things for total
>> > counts, either two separate queries, one just a 'SELECT COUNT(*)' and
>> the
>> > other to actually fetch the data. Depending on your data you might
be
>> able
>> > to add the count into your data fetching query but probably not.
>> >
>> > Why do you not want to use the modules?
>>
>> Thank you Tyler, I hadn't though about just using select COUNT(*).
>>
>
> One thing people sometimes do if they have a lot of rows (a whole lot)
is to
> actually keep a separate table that stores the count and then you can
just
> select from that. It is not recommended unless you really have a lot of
> rows because it de-normalizes the database. The count() should work
fine
> however.
>
Keep in mind that count() is database dependent, even database-engine
dependent. For instance, mySQL's MyISAM engine keeps a running count of
the
number of rows in a table, so count() is cheap. Buy the InnoDB engine does
*not* keep that running total, so count() is relatively expensive. If
you're
talking a few hundred or thousand rows, it shouldn't be a problem--but if
you're talking large numbers (six million rows of genomic data, anyone),
then it'll probably be an issue.
Paul


|