Curiousity about indexing, again - Mailing list pgsql-general

From Felix Morley Finch
Subject Curiousity about indexing, again
Date
Msg-id 14208.12373.135280.468798@crowfix.com
Whole thread Raw
Responses Re: [GENERAL] Curiousity about indexing, again
List 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 by date:

Previous
From: "Ross J. Reedstrom"
Date:
Subject: Re: [GENERAL] GROUP BY problem with 6.5
Next
From: Don Yury
Date:
Subject: oid as a reference