Re: PLEASE GOD HELP US!

Поиск
Список
Период
Сортировка
От Uwe C. Schroeder
Тема Re: PLEASE GOD HELP US!
Дата
Msg-id 200410011348.41695.uwe@oss4u.com
обсуждение исходный текст
Ответ на Re: PLEASE GOD HELP US!  ("Shane | SkinnyCorp" <shanew@skinnycorp.com>)
Список pgsql-admin
-----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-----


В списке pgsql-admin по дате отправления:

Предыдущее
От: "Shane | SkinnyCorp"
Дата:
Сообщение: Re: PLEASE GOD HELP US!
Следующее
От: "Igor Maciel Macaubas"
Дата:
Сообщение: Does PostgreSQL Stores its database in multiple disks?