Re:

Поиск
Список
Период
Сортировка
От Andrew McMillan
Тема Re:
Дата
Msg-id 1044693339.4874.17.camel@kant.mcmillan.net.nz
обсуждение исходный текст
Ответ на Re:  (greg@turnstep.com)
Ответы lock timeout in pgsql 7.3.1  (Muhammad Shariq Muzaffar <shariq77@yahoo.com>)
Re:  (greg@turnstep.com)
Список pgsql-novice
On Sat, 2003-02-08 at 04:48, greg@turnstep.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/
---------------------------------------------------------------------


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

Предыдущее
От: greg@turnstep.com
Дата:
Сообщение: Re: Inaccurate results
Следующее
От: Muhammad Shariq Muzaffar
Дата:
Сообщение: lock timeout in pgsql 7.3.1