From: | Andrew McMillan <andrew(at)catalyst(dot)net(dot)nz> |
---|---|
To: | greg(at)turnstep(dot)com |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: |
Date: | 2003-02-08 08:35:39 |
Message-ID: | 1044693339.4874.17.camel@kant.mcmillan.net.nz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
On Sat, 2003-02-08 at 04:48, greg(at)turnstep(dot)com wrote:
> > Greg Sabino Mullane (in the other thread) suggested the following alternate,
> > but it ran slightly slower on my machine than the original.
> >
> > SELECT id, date, value FROM sample a WHERE date <='2003-01-01' AND oid =
> > (SELECT oid FROM sample WHERE id = a.id AND DATE <='2003-01-01' ORDER BY
> > date DESC LIMIT 1)
> > ORDER BY id;
>
> You should check this again. There is no way that my query is slower, as
> long as you have an index on the "date" column and have run an ANALYZE on
> the "sample" table.
Wouldn't there need to be an index on OID for your query to be fast?
Cheers,
Andrew.
--
---------------------------------------------------------------------
Andrew @ Catalyst .Net.NZ Ltd, PO Box 11-053, Manners St, Wellington
WEB: http://catalyst.net.nz/ PHYS: Level 2, 150-154 Willis St
DDI: +64(4)916-7201 MOB: +64(21)635-694 OFFICE: +64(4)499-2267
Survey for nothing with http://survey.net.nz/
---------------------------------------------------------------------
From | Date | Subject | |
---|---|---|---|
Next Message | Muhammad Shariq Muzaffar | 2003-02-08 10:20:13 | lock timeout in pgsql 7.3.1 |
Previous Message | greg | 2003-02-07 19:16:37 | Re: Inaccurate results |