#27719: Add queryset.alias() to mimic .annotate() for aggregations without loading data -------------------------------------+------------------------------------- Reporter: Marc | Owner: nobody Tamlyn | Type: New | Status: new feature | Component: Database | Version: master layer (models, ORM) | Severity: Normal | Keywords: Triage Stage: | Has patch: 0 Unreviewed | Needs documentation: 0 | Needs tests: 0 Patch needs improvement: 0 | Easy pickings: 0 UI/UX: 0 | -------------------------------------+------------------------------------- At the moment the Expressions API currently does not allow creating a value for later use in the query without returning that data from the database. In some cases this can be quite expensive over the pipe, and can also influence query execution where functional indexes are involved. I would like to introduce an API like `alias()`, which does the same thing as `annotate()` to allow reuse in later querysets but doesn't return the value.
To be explicit, we are changing a query from one of the form: `SELECT to_tsvector('english', "some_field"), "some", "other", "fields" FROM "table" WHERE to_tsvector('english', "some_field") @@ plainto_tsquery("search term") ... LIMIT 10;` to one of the form: `SELECT "some", "other", "fields" FROM "table" WHERE to_tsvector('english', "some_field") @@ plainto_tsquery("search term") ... LIMIT 10;` -- Ticket URL: <https://code.djangoproject.com/ticket/27719> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/051.e0f34e5e8198bdb464d6a04328d03016%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.