From: | jhood(at)hmcon(dot)com (Jeffrey Hood) |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Query Performance... |
Date: | 2002-07-17 20:31:29 |
Message-ID: | a2c11736.0207171231.22cae5e6@posting.google.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
We have recently converted from MS SQLServer 7 to Postgres 7.1... The
following query runs perfectly fine in SQL Server with any where
clause attached, but in Postgres runs fine until you put a where
clause that has *no* criteria for Patients... then it runs forever...
the table sizes are approx:
Patients: 1.5M rows
Dr: 2000 rows
Dr Groups: 500 rows
Rx: 750000 rows
All of the fields that are joined and used in where clauses are
indexed, and the query that has problems is:
SELECT
Pharm.Name, Pharm.City, Pharm.Phone,
Dr.LastName, Dr.City, Dr.Phone,
DrGroup.Name,
P.LastName, P.FirstName,P.DOB,
Rx.Medication, Rx.Unit, Rx.Qty
FROM Rx
INNER JOIN Pharm ON Rx.PharmID = Pharm.PharmID
INNER JOIN Dr ON Rx.DrID = Dr.DrID
INNER JOIN Patient P ON Rx.PatientID = P.PatientID
LEFT OUTER JOIN DrGroup ON Dr.DrGroupID = DrGroup.DrGroupID
I figure that there must be some other way to get it to run...
Any help is appreciated...
JH
From | Date | Subject | |
---|---|---|---|
Next Message | Rosario Peluso | 2002-07-17 20:39:45 | Command execution goes stuck... |
Previous Message | Neil Conway | 2002-07-17 20:25:42 | Re: dropping anonymous constraints |