coding practice

Jan 18, 2006 11:06

this is now part of our in-house coding standards:

SELECT count(*) as dracula FROM image

work, geek

Leave a comment

Comments 6

thunderbox January 18 2006, 12:33:30 UTC
I'm sure with a bit of effort you could come up with a working syntax using SET ESCAPE with count and Monte_Cristo…

Reply


spride January 18 2006, 13:18:51 UTC
Isn't it less expensive to count a single column?

Reply

budleysalterton January 19 2006, 09:10:34 UTC
only if the column is called vlad

Reply

perlmonger January 19 2006, 12:14:59 UTC
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.

Reply

spride January 19 2006, 12:29:08 UTC
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.

Reply


Leave a comment

Up