Curiousity about indexing, again
От | Felix Morley Finch |
---|---|
Тема | Curiousity about indexing, again |
Дата | |
Msg-id | 14208.12373.135280.468798@crowfix.com обсуждение исходный текст |
Ответы |
Re: [GENERAL] Curiousity about indexing, again
|
Список | pgsql-general |
I recently asked why my "select * from hltdata order by stmp limit 10" did not use the index; Hiroshi Inoue, Inoue@tpf.co.jp, told me that LIMIT is ignored by the optimizer. Apparently it assumes it will return every record, so a sequential scan is good enough. Adding "where 'now' > stmp" (stmp is type datetime) tricks the optimizer appropriately. However, it only does so for "order by stmp". If I use "order by stmp DESC", explain says it will have to sort before doing the index scan. Is this reasonable behavior? And is there some way to create an index that it will use for "order desc"? I tried adding DESC after the column name when creating an index, but no luck. -- ... _._. ._ ._. . _._. ._. ___ .__ ._. . .__. ._ .. ._. Felix Finch: scarecrow repairman & rocket surgeon / felix@crowfix.com PGP = 91 B3 94 7C E9 E8 76 2D E1 63 51 AA A0 48 89 2F ITAR license #4933 I've found a solution to Fermat's Last Theorem but I see I've run out of room o
В списке pgsql-general по дате отправления: