#24638: New feature: support adding an SQL comment in queries
-------------------------------------+-------------------------------------
     Reporter:  adamchainz           |                    Owner:  nobody
         Type:  New feature          |                   Status:  new
    Component:  Database layer       |                  Version:  1.8
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  queryset, query,     |             Triage Stage:  Accepted
  comment, optimizer hint            |
    Has patch:  1                    |      Needs documentation:  1
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by adamchainz):

 For reference (checking I did get the right place for Oracle and MySQL
 query hints):

 1. MySQL hints are listed in its syntax
 https://dev.mysql.com/doc/refman/5.5/en/select.html (STRAIGHT_JOIN,
 SQL_NO_CACHE, etc.). They can be inserted as comments by starting the
 comment with an exclamation mark, which pretty much means "this is not a
 comment" (the reason this exists is that if you follow the exclamation
 mark with an encoded version number, that SQL will only be executed on
 versions of the server at that version or above). Also newer more powerful
 hints are coming in 5.7 with comments that start with a + :
 https://dev.mysql.com/worklog/task/?id=8017

 2. Oracle has extensive documentation on its hints which appear only in
 conditional comments, although the page is lacking in examples:
 http://docs.oracle.com/cd/B19306_01/server.102/b14211/hintsref.htm .
 However the syntax for SELECT does show hints going *before* DISTINCT:
 http://docs.oracle.com/cd/B28359_01/server.111/b28286/statements_10002.htm
 , however this blog post shows them after: http://www.dba-
 oracle.com/t_index_fast_full_scan.htm .

--
Ticket URL: <https://code.djangoproject.com/ticket/24638#comment:5>
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.1bf994926f14ba90f5415e989ea609f2%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to