Curiousity about indexing, again

From: Felix Morley Finch <felix(at)crowfix(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Curiousity about indexing, again
Date: 1999-07-05 04:11:01
Message-ID: 14208.12373.135280.468798@crowfix.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I recently asked why my "select * from hltdata order by stmp limit 10"
did not use the index; Hiroshi Inoue, Inoue(at)tpf(dot)co(dot)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(at)crowfix(dot)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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Hub.Org News Admin 1999-07-05 06:23:59
Previous Message Ross J. Reedstrom 1999-07-05 03:42:57 Re: [GENERAL] GROUP BY problem with 6.5