Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
#12192: Don't execute sql query with limit 0
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Django  
View profile  
 More options Nov 9 2009, 2:48 am
From: "Django" <nore...@djangoproject.com>
Date: Mon, 09 Nov 2009 07:48:57 -0000
Local: Mon, Nov 9 2009 2:48 am
Subject: [Django] #12192: Don't execute sql query with limit 0
#12192: Don't execute sql query with limit 0
------------------------------------------+-------------------------------- -
 Reporter:  Suor                          |       Owner:  nobody    
   Status:  new                           |   Milestone:            
Component:  Database layer (models, ORM)  |     Version:  1.1      
 Keywords:                                |       Stage:  Unreviewed
Has_patch:  0                             |  
------------------------------------------+-------------------------------- -
 When QuerySet.query has low_mark == high_mark (happens in pagination for
 example) ORM executes a query like:
 {{{
     select ... from ... limit 0
 }}}

--
Ticket URL: <http://code.djangoproject.com/ticket/12192>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Django  
View profile  
 More options Dec 10 2009, 6:27 am
From: "Django" <nore...@djangoproject.com>
Date: Thu, 10 Dec 2009 11:27:56 -0000
Local: Thurs, Dec 10 2009 6:27 am
Subject: Re: [Django] #12192: Don't execute sql query with limit 0
#12192: Don't execute sql query with limit 0
---------------------------------------------------+----------------------- -
          Reporter:  Suor                          |         Owner:  ramiro
            Status:  new                           |     Milestone:        
         Component:  Database layer (models, ORM)  |       Version:  1.1  
        Resolution:                                |      Keywords:        
             Stage:  Design decision needed        |     Has_patch:  1    
        Needs_docs:  0                             |   Needs_tests:  0    
Needs_better_patch:  0                             |  
---------------------------------------------------+----------------------- -
Changes (by ramiro):

  * needs_better_patch:  => 0
  * needs_tests:  => 0
  * owner:  nobody => ramiro
  * needs_docs:  => 0
  * has_patch:  0 => 1
  * stage:  Unreviewed => Design decision needed

Comment:

 I've attached two patches that implement detection of the `high_mark ==
 low_mark` condition and avoid going to the DB with such a query, the
 second patch could be even slightly more efficient because it shortcuts
 execution of `Query.as_sql()` early completely avoiding the setup and
 generation of the SQL query text.

 One thing to review  and decide is that isn't clear from the docstrings
 and comments what `Query.as_sql()` is supposed to return to signal no SQL
 query text was generated. The patches currently return an empty string but
 I don't know now if it should be None.

 Tests that exercise this already exist in `modeltests/basic` and
 `regressiontests/queries`.

--
Ticket URL: <http://code.djangoproject.com/ticket/12192#comment:1>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Django  
View profile  
 More options Jan 10 2010, 11:09 am
From: "Django" <nore...@djangoproject.com>
Date: Sun, 10 Jan 2010 16:09:28 -0000
Local: Sun, Jan 10 2010 11:09 am
Subject: Re: [Django] #12192: Don't execute sql query with limit 0
#12192: Don't execute sql query with limit 0
---------------------------------------------------+----------------------- -
          Reporter:  Suor                          |         Owner:  ramiro
            Status:  new                           |     Milestone:        
         Component:  Database layer (models, ORM)  |       Version:  SVN  
        Resolution:                                |      Keywords:        
             Stage:  Design decision needed        |     Has_patch:  1    
        Needs_docs:  0                             |   Needs_tests:  0    
Needs_better_patch:  0                             |  
---------------------------------------------------+----------------------- -
Changes (by ramiro):

  * version:  1.1 => SVN

Comment:

 I've updated the patches for this ticket to trunk status after the multi-
 db merge.

 If/once one of the are chosen and applied to trunk, then the similarly
 named chosen among `12192-patch1.diff` and `12192-patch2.diff` could be
 applied to `1.1.x` as they should still apply correctly there.

--
Ticket URL: <http://code.djangoproject.com/ticket/12192#comment:2>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Django  
View profile  
 More options Feb 23 2010, 8:55 am
From: "Django" <nore...@djangoproject.com>
Date: Tue, 23 Feb 2010 13:55:17 -0000
Local: Tues, Feb 23 2010 8:55 am
Subject: Re: [Django] #12192: Don't execute sql query with limit 0
#12192: Don't execute sql query with limit 0
---------------------------------------------------+----------------------- -
          Reporter:  Suor                          |         Owner:  ramiro
            Status:  new                           |     Milestone:        
         Component:  Database layer (models, ORM)  |       Version:  SVN  
        Resolution:                                |      Keywords:        
             Stage:  Design decision needed        |     Has_patch:  1    
        Needs_docs:  0                             |   Needs_tests:  0    
Needs_better_patch:  0                             |  
---------------------------------------------------+----------------------- -
Comment (by ramiro):

 Patches were fixed and updated to r12492. Both of them were tested by
 running the Django test suite against MySQL, PostgreSQL and sqlite3 and it
 was verified none of them introduced errors.

--
Ticket URL: <http://code.djangoproject.com/ticket/12192#comment:3>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »