MySQL, in this situation, would have to actually select a row to return a result, so it's slower. If it was just select 1 as a from table where indexed_value = N, it doesn't even hit the tables, just the indexes.
It's definitely not more efficient, and probably just an oversight somewhere. On Feb 10, 7:35 am, Jeremy Dunck <jdu...@gmail.com> wrote: > On Wed, Feb 10, 2010 at 2:05 AM, Karen Tracey <kmtra...@gmail.com> wrote: > > ... > > >> * What version of Django (including SVN revision, if appropriate) are > >> you using? > > > I tried current trunk and backed off to the changeset where the function was > > added -- query was the same. Looking at the idiom it replaced, the extra > > select of the constant 1 value as 'a' was followed by a values('a') that > > turned the result into a ValuesQuerySet. I don't see where this is being > > done with the exists() implementation. As a result it seems to be a regular > > QuerySet with a query with default_cols=True, resulting in all the default > > columns getting pulled into the query. > > It seems odd to me that adding columns to the result of a returned row > would be significantly slower than the PK. It also seems to me that > using the default ordering might be unnecessary overhead, too. > > But I wonder if different DBs return different things based on the > columns in the select clause? Perhaps Malcolm had a reason for making > the change. :-/ -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-develop...@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.