this is now part of our in-house coding standards:
SELECT count(*) as dracula FROM image
6 thoughts on “coding practice”
I’m sure with a bit of effort you could come up with a working syntax using SET ESCAPE with count and Monte_Cristo…
Isn’t it less expensive to count a single column?
only if the column is called vlad
I’m not quite anal enough to benchmark it properly (though a few quick checks on a 2167462 row table showed no significant difference), but I’d have said that in theory “count(*)” gives the DBMS a pretty strong hint that the client isn’t interested in table content, so if anything it should be optimised better.
that reminds me of the Oracle developer I once met that used the ROWID column as a metric of table size…ie SELECT MAX (ROWID) FROM foo = number of rows in foo.
I’m sure with a bit of effort you could come up with a working syntax using SET ESCAPE with count and Monte_Cristo…
Isn’t it less expensive to count a single column?
only if the column is called vlad
I’m not quite anal enough to benchmark it properly (though a few quick checks on a 2167462 row table showed no significant difference), but I’d have said that in theory “count(*)” gives the DBMS a pretty strong hint that the client isn’t interested in table content, so if anything it should be optimised better.
that reminds me of the Oracle developer I once met that used the ROWID column as a metric of table size…ie SELECT MAX (ROWID) FROM foo = number of rows in foo.
well, I suppose it establishes an upper bound… 🙂