Re: [GENERAL] slow queries

Поиск
Список
Период
Сортировка
От Thomas Good
Тема Re: [GENERAL] slow queries
Дата
Msg-id Pine.LNX.3.96.980918121541.24729A-100000@admin.nrnet.org
обсуждение исходный текст
Ответ на Re: [GENERAL] slow queries  (David Hartwig <daveh@insightdist.com>)
Ответы Re: [GENERAL] slow queries  (Howie <caffeine@toodarkpark.org>)
Список pgsql-general
On Fri, 18 Sep 1998, David Hartwig wrote:

> I would like to see it!   I was not aware that table aliasing could
> have any impact on performance.

Hello Oliver and David,

I was a bit amazed myself.  Federico Passaro, on the SQL list,
helped me out some time ago when a query was failing.
His code worked so well that I filed it away for a rainy day...
this week I decided to try it and see if it helped hasten my
slooooowest query.  It did.

Here is my code (hope it's coherent, I didn't name the tables!):

#!/bin/sh
tput clear
echo -ne "Enter Unit Code: "
read unit
psql millie <<EOF | less
SELECT unit_lname FROM crund1 WHERE unit_id = ${unit};
SELECT S.tr_id, T.i_date, S.client_lname, S.client_fname, S.eth_nic
FROM svcrd1 S, trhist T
WHERE S.client_id = T.pt_id
AND T.unit_id = ${unit}
AND T.o_date IS NULL
ORDER BY S.client_lname;
EOF

Cheers,
Tom

    ---------- Sisters of Charity Medical Center ----------
                   Department of Psychiatry
                            ----
    Thomas Good                          <tomg@q8.nrnet.org>
    Coordinator, North Richmond C.M.H.C. Information Systems
    75 Vanderbilt Ave, Quarters 8        Phone: 718-354-5528
    Staten Island, NY   10304            Fax:   718-354-5056


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

Предыдущее
От: "Wim Ceulemans"
Дата:
Сообщение: Re: [GENERAL] slow queries
Следующее
От: Mr Richard Wang
Дата:
Сообщение: Redhat Postgres 6.3