First of all, I didn't know about .exists(). That's great! I think syntactically it looks better than converting a count integer to a boolean.
In terms of SQL query complexity it's got the same complexity as a count. I'd need a larger set and a more realistic query to find out which is most cost effective (or rather, least costly) the LIMIT or the COUNT.
Out of interest, how does these methods compare with QuerySet.exists()? That method is supposed to be fast, but I'm guessing from the Postgres side it might do effectively the same amount of work.
Comment
First of all, I didn't know about .exists(). That's great! I think syntactically it looks better than converting a count integer to a boolean.
In terms of SQL query complexity it's got the same complexity as a count. I'd need a larger set and a more realistic query to find out which is most cost effective (or rather, least costly) the LIMIT or the COUNT.
Thanks for the tip!
Parent comment
Out of interest, how does these methods compare with QuerySet.exists()? That method is supposed to be fast, but I'm guessing from the Postgres side it might do effectively the same amount of work.