[egenix-users] cursor.rowcount abnormalities and performance
Paul.Moore at atosorigin.com
Thu Jul 31 13:01:27 CEST 2003
From: M.-A. Lemburg [mailto:mal at lemburg.com]
> If cursor.execute('SELECT @@ROWCOUNT') works on all MS Server
> versions out there, no problem. But if it's really that easy to
> fetch the value I wonder why MS didn't put the same logic into their
> ODBC drivers... I presume that this operation is rather costly.
I don't know about MS, but under Oracle (where "SELECT @@ROWCOUNT"
definitely doesn't work, but there are equivalents) getting the
rowcount is *extremely* costly compared to just fetching the first
row. Imagine a 10 million row table. You can get the first row just by
a single read, but to count the number of rows, you have to read the
whole table before returning the first row.
(OK, a full table read is simple - imagine there was a condition on an
More information about the egenix-users