On Thu, Sep 6, 2012 at 2:40 AM, Ian Kelly <ian.g.ke...@gmail.com> wrote: > On Wed, Sep 5, 2012 at 9:34 AM, Chris Angelico <ros...@gmail.com> wrote: >> On Thu, Sep 6, 2012 at 1:22 AM, Ian Kelly <ian.g.ke...@gmail.com> wrote: >>> The lack of an ORDER BY is the least of the problems with that SQL. >>> He's also using LIMIT without OFFSET, so the only thing that the >>> 'item' argument changes is how many rows are returned (all but one of >>> which are ignored), not which one is actually fetched. >> >> No, he's using the two-arg form of LIMIT. > > My mistake. I didn't even know there was a two-arg form of LIMIT. > Must be a MySQL thing. :-)
Yeah, it's not something I've used, but when my current job started, we were using MySQL and I used to eyeball the logs to see what queries were performing most suboptimally. (There were some pretty egregious ones. Most memorable was rewriting a TEXT field several times a second with several KB of PHP serialized array with status/statistical information. Structured information, yes. Stored as a clob.) My first databasing experience was DB2, with the uber-verbose "FETCH FIRST n ROW[S] ONLY", but now I'm happily on Postgres. Everyone who wants to use LIMIT without ORDER BY should try their code on Postgres. You'll quickly discover the problem. ChrisA -- http://mail.python.org/mailman/listinfo/python-list