pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephan Szabo <sszabo@megazone.bigpanda.com>
To: Gaetano Mendola <mendola@bigfoot.com>
Cc: Scott Marlowe <smarlowe@qwest.net>
Cc: pgsql-admin@postgresql.org
Subject: Re: PLEASE GOD HELP US!
Date: Sun, 3 Oct 2004 10:45:36 -0700 (PDT)
Message-ID: <20041003104231.M47800@megazone.bigpanda.com> (raw)
In-Reply-To: <415FE6AD.80507@bigfoot.com>
References: <00ab01c4a7f4$f04fffd0$3402a8c0@shanepc>
	<1096691616.2611.22.camel@localhost.localdomain>
	<20041002080923.C99145@megazone.bigpanda.com>
	<1096751454.2611.33.camel@localhost.localdomain>
	<415FE6AD.80507@bigfoot.com>


On Sun, 3 Oct 2004, Gaetano Mendola wrote:

> Scott Marlowe wrote:
> > On Sat, 2004-10-02 at 09:14, Stephan Szabo wrote:
> >
> >>On Fri, 1 Oct 2004, Scott Marlowe wrote:
> >>
> >>
> >>>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
> >>
> >>Probably not, because I don't think he wants the other statuses to have
> >>special ranking over the others, so a status=4 and status=1 row should be
> >>sorted by lastreply only effectively. This is the problem of combining
> >>separate status flags into a single field if you want to be doing these
> >>sorts of queries.
> >>
> >
> >
> > So would a union give good performance?  Just union the first 25 or less
> > with status=5 with the rest, using a 1 and 0 in each union to order by
> > first?  Hopefully the indexes would then be used.
>
> anyone seen that the OP is running the server with sequential scan disabled ?

Yep, but he's doing some queries for which the indexes weren't useful
unless he had some very specific ones, so it'd still be choosing
sequential scans for those AFAICT (for example I believe the 9s get the
first 25 threads query).

I think someone'd already pointed out that running with sequential scan
disabled is generally a bad idea, so I didn't think it was worth
mentioning again.



view thread (33+ messages)  latest in thread

Message-ID: <20041003104231.M47800@megazone.bigpanda.com>
Permalink:  ../20041003104231.M47800@megazone.bigpanda.com/
Also on:    postgresql.org/message-id/20041003104231.M47800@megazone.bigpanda.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: sszabo@megazone.bigpanda.com, mendola@bigfoot.com, smarlowe@qwest.net
  Subject: Re: PLEASE GOD HELP US!
  In-Reply-To: <20041003104231.M47800@megazone.bigpanda.com>
  References: <00ab01c4a7f4$f04fffd0$3402a8c0@shanepc> <1096691616.2611.22.camel@localhost.localdomain> <20041002080923.C99145@megazone.bigpanda.com> <1096751454.2611.33.camel@localhost.localdomain> <415FE6AD.80507@bigfoot.com> <20041003104231.M47800@megazone.bigpanda.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox