X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CCF5232A149 for ; Sat, 2 Oct 2004 05:31:48 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 47105-10 for ; Sat, 2 Oct 2004 04:31:39 +0000 (GMT) Received: from mpls-qmqp-02.inet.qwest.net (mpls-qmqp-02.inet.qwest.net [63.231.195.113]) by svr1.postgresql.org (Postfix) with SMTP id A8B3C32A52F for ; Sat, 2 Oct 2004 05:31:38 +0100 (BST) Received: (qmail 8893 invoked by uid 0); 2 Oct 2004 03:12:46 -0000 Received: from mpls-pop-10.inet.qwest.net (63.231.195.10) by mpls-qmqp-02.inet.qwest.net with QMQP; 2 Oct 2004 03:12:46 -0000 Received: from 63-227-127-37.dnvr.qwest.net (HELO ?10.0.0.2?) (63.227.127.37) by mpls-pop-10.inet.qwest.net with SMTP; 2 Oct 2004 04:31:37 -0000 Date: Fri, 01 Oct 2004 22:33:36 -0600 Message-Id: <1096691616.2611.22.camel@localhost.localdomain> From: "Scott Marlowe" To: "Shane | SkinnyCorp" Cc: "PgSQL ADMIN" Subject: Re: PLEASE GOD HELP US! In-Reply-To: <00ab01c4a7f4$f04fffd0$3402a8c0@shanepc> References: <00ab01c4a7f4$f04fffd0$3402a8c0@shanepc> Content-Type: text/plain Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200410/45 X-Sequence-Number: 15039 On Fri, 2004-10-01 at 14:26, Shane | SkinnyCorp wrote: > Okay, just so no one posts about this again... > > the 'ORDER BY t.status=5,lastreply' clause is meant to float the threads > with a status of '5' to the top of the list... it is NOT meant to only grab > threads where the status = 5. Oh and believe me, when I take this out of > the query, it CERTAINLY doesn't add any more than possible 1/4 of a > millesecond to the speed of the SELECT statement. Wouldn't this work just as well? SELECT * FROM thread_listing AS t ORDER BY t.status DESC,t.lastreply desc LIMIT 25 OFFSET 0 Assuming 5 is the highest number. If not, a where clause entry might make sense. SELECT * FROM thread_listing AS t WHERE t.status <= 5 ORDER BY t.status DESC,t.lastreply desc LIMIT 25 OFFSET 0 Or is the data set put together some weird way that makes that impossible?