mysqldb: Rows READ or Processed

Carsten Haese carsten at
Thu Feb 7 01:19:39 CET 2008

On Wed, 2008-02-06 at 14:51 -0800, mcl wrote:
> I have looked through Python Database API Specification v2.0, but can
> not find any reference to the number of records processed in a select
> query.
> I know I can get the number of records returned with cursor.rowcount,
> but I want to know the number of records processed.
> I suppose the info is in one of the internal tables, but I can not
> find any info on that, because phpMyAdmin shows the number of rows in
> a table.
> I suppose I could use count(*), but would that process all the
> records, which would seem a bit silly.
> What is the best method ?

Please define what you mean by "processed". If you simply need to know
how many rows are in a table, "select count(*) from that_table" is the
obvious solution. If the database engine is sufficiently intelligent, it
won't have to read the data in every single row to count the rows.

If that's not what you're looking for, please feel free to be more
specific about what you need to achieve.

Carsten Haese

More information about the Python-list mailing list