Re: [GENERAL] slow queries - Mailing list pgsql-general

From Thomas Good
Subject Re: [GENERAL] slow queries
Date
Msg-id Pine.LNX.3.96.980918121541.24729A-100000@admin.nrnet.org
Whole thread Raw
In response to Re: [GENERAL] slow queries  (David Hartwig <daveh@insightdist.com>)
Responses Re: [GENERAL] slow queries
List 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 by date:

Previous
From: "Wim Ceulemans"
Date:
Subject: Re: [GENERAL] slow queries
Next
From: Mr Richard Wang
Date:
Subject: Redhat Postgres 6.3