Hi all,
I'm wondering if there's a way to generate more compact queries in the
DB layer.
For example, when I have a model:
===============
class Object(models.Model):
bar = models.ForeignKey(...)
foo = models.CharField(...)
something = models.DateTimeField(...)
===============
Object.objects.get(pk=1) results in the following query (I think):
===============
SELECT
`app_object`.`id`,`app_object`.`bar_id`,`app_object`.`foo`,`app_object`.`something`
FROM `app_object` WHERE (`app_object`.`id` = 1)
===============
(138 chars)
This could be turned into:
===============
SELECT `a`.`id`,`a`.`bar_id`,`a`.`foo`,`a`.`something` FROM
`app_object` as `a` WHERE (`a`.`id` = 1)
===============
(100 chars ~ 25% reduction)
Or in the general case (without .values(), all entries are requested):
===============
SELECT * FROM `app_object` as `a` WHERE (`a`.`id` = 1)
===============
(54 chars ~ 60% reduction)
So, my first question is... is this possible?
My second question is... if we can, is there any real value
(specifically for very large sites)?
Thanks,
--Ben
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-developers
-~----------~----~----~----~------~----~------~--~---