Re: help optimizing query - Mailing list pgsql-general

From Adam Rich
Subject Re: help optimizing query
Date
Msg-id 00af01c86b89$5607ea30$0217be90$@r@sbcglobal.net
Whole thread Raw
In response to help optimizing query  (rihad <rihad@mail.ru>)
List pgsql-general
> It seems to do the job, but how good is it in the long run? Any way I
> could tweak it?


I think this form will work the best:


SELECT u.login, MAX(s.stop_time) AS last_use_time
FROM users u, stats s
WHERE u.id=s.user_id
AND u.status='3' AND u.next_plan_id IS NULL
GROUP BY u.login
HAVING MAX(s.stop_time) < (now() - interval '1 month')
ORDER BY last_use_time;



pgsql-general by date:

Previous
From: "Dean Gibson (DB Administrator)"
Date:
Subject: Where is the system-wide psqlrc on RHEL4?
Next
From: Tom Lane
Date:
Subject: Re: Where is the system-wide psqlrc on RHEL4?