On Wednesday 17 June 2009 19.08:10 klaus wrote:
> ... whether a query will yield any result ...

> The best approximation
> seems to be
>      query.first() is not None
> which can select a lot of columns. I often see
>      query.count() > 0
> which can become quite expensive on a DBMS like PostgreSQL.

Just a side note that pg tends to compute first() efficiently if (and I 
assume sa does this) the implementation uses LIMIT to tell the db that 
really only the first row is interesting.  I don't know about other 
databases.

cheers
-- vbi


-- 
this email is protected by a digital signature: http://fortytwo.ch/gpg

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to