Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'argument': 0.04; 'subject:Python': 0.05; 'sql.': 0.07; 'rows': 0.09; 'sep': 0.09; 'yeah,': 0.09; 'stored': 0.10; ':-)': 0.13; '(there': 0.16; 'db2,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'happily': 0.16; 'limit.': 0.16; 'mistake.': 0.16; 'offset,': 0.16; 'only",': 0.16; 'rewriting': 0.16; 'wed,': 0.16; 'wrote:': 0.17; 'thu,': 0.17; '>>>': 0.18; 'changes': 0.20; 'received:209.85.214.174': 0.21; '(all': 0.22; 'ones.': 0.22; 'subject:Questions': 0.22; "i've": 0.23; 'second': 0.24; 'least': 0.25; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'used,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'chris': 0.28; 'yes.': 0.29; 'array': 0.29; 'no,': 0.29; "i'm": 0.29; 'performing': 0.30; 'returned': 0.30; 'code': 0.31; 'problem.': 0.32; 'quickly': 0.32; "he's": 0.33; 'to:addr:python-list': 0.33; 'everyone': 0.33; 'received:google.com': 0.34; 'text': 0.34; 'received:209.85': 0.35; 'something': 0.35; 'there': 0.35; 'but': 0.36; "didn't": 0.36; 'should': 0.36; 'problems': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'several': 0.39; 'to:addr:python.org': 0.39; 'received:209.85.214': 0.39; 'header:Received:5': 0.40; 'most': 0.61; 'first': 0.61; "you'll": 0.62; 'times': 0.63; 'information,': 0.63; 'limit': 0.65; 'lack': 0.71; 'discover': 0.72; 'subject:Interview': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=H3DYfsJWBTiln9UD88aSIHvKKfyVwE4ZbFnhFK+ffHk=; b=XrSImworIfhHUnAGmEKJE6zTQg9jfNnxqFTBuWFFxZ75mNVbeICGTXDrTvURhsFq5d ByFYCYAc7K2zff6go5rYQWYeftzB+Jh6qrzjw/g/QHLpJfxxetH6yu51W+Snt4Zn3XDt 8sLuH07Hsgw6f+lh5iTDwzvf4jBrzTsEOJvmmBn8qRkKzavkKDhArzoo9RlAx78Q0OGh r4T82VtNikk+EcoVwemAmX2DrCKjG9cykZIRtimBrn0BuUYnuwWuSugfKbXRfzkAzomq ka4XnBy1hR5++tNfGgNyZRzc3OTyaZaTRnqqPqA3vBCuF8XQmhVia6TkDDUBcBd+K/hl qICA== MIME-Version: 1.0 In-Reply-To: References: <1193768041.349129.26350@v3g2000hsg.googlegroups.com> Date: Thu, 6 Sep 2012 08:13:44 +1000 Subject: Re: Python Interview Questions From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 26 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1346883227 news.xs4all.nl 6940 [2001:888:2000:d::a6]:51628 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:28543 On Thu, Sep 6, 2012 at 2:40 AM, Ian Kelly wrote: > On Wed, Sep 5, 2012 at 9:34 AM, Chris Angelico wrote: >> On Thu, Sep 6, 2012 at 1:22 AM, Ian Kelly 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