pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Uwe C. Schroeder <uwe@oss4u.com>
To: Shane | SkinnyCorp <shanew@skinnycorp.com>
To: PgSQL ADMIN <pgsql-admin@postgresql.org>
Subject: Re: PLEASE GOD HELP US!
Date: Fri, 1 Oct 2004 13:48:41 -0700
Message-ID: <200410011348.41695.uwe@oss4u.com> (raw)
In-Reply-To: <00ab01c4a7f4$f04fffd0$3402a8c0@shanepc>
References: <00ab01c4a7f4$f04fffd0$3402a8c0@shanepc>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Friday 01 October 2004 01:26 pm, 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.
>

One quick idea that comes to my head without knowing your database structure 
(which would be neccessary to do this properly) is:
use a serial field as row key (int4 with a sequence as default)
in your query grab the current value from the sequence, subtract 25 and select 
all records with a key larger than that number.
Et voila: you only select 25 records with a where clause that will use an 
index properly. I bet that runs in a couple of milliseconds.

BTW: You're asking and complaining about a "lagging database". You think 
nothing you did is at fault. Why then ask in the first place if you don't 
want to hear the answers?
I've been working with databases long before postgres was born (over 23 
years). I still ask questions on this list and usually get good responses. 


UC

- --
Open Source Solutions 4U, LLC	2570 Fleetwood Drive
Phone:  +1 650 872 2425		San Bruno, CA 94066
Cell:   +1 650 302 2405		United States
Fax:    +1 650 872 2417
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQFBXcKpjqGXBvRToM4RAv4YAJ9cj/P+vCbbJXNf1G5Dh3dWnZzkDQCgqdfa
lxicqf7qRS6hA7Zzv0v94/U=
=e94/
-----END PGP SIGNATURE-----




view thread (33+ messages)  latest in thread

Message-ID: <200410011348.41695.uwe@oss4u.com>
Permalink:  ../200410011348.41695.uwe@oss4u.com/
Also on:    postgresql.org/message-id/200410011348.41695.uwe@oss4u.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: uwe@oss4u.com, shanew@skinnycorp.com
  Subject: Re: PLEASE GOD HELP US!
  In-Reply-To: <200410011348.41695.uwe@oss4u.com>
  References: <00ab01c4a7f4$f04fffd0$3402a8c0@shanepc> <200410011348.41695.uwe@oss4u.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