=?iso-8859-2?Q?Egy=FCd_Csaba?= <csegyud@vnet.hu> writes:
> Limit (cost=30.28..30.28 rows=1 width=58) (actual time=0.19..0.19 rows=1
> loops=1)
> -> Sort (cost=30.28..30.30 rows=7 width=58) (actual time=0.18..0.18
> rows=2 loops=1)
> Sort Key: stockid, productid, changeid, date, "time"
> -> Index Scan using t_stockchanges_fullindex on t_stockchanges
> (cost=0.00..30.18 rows=7 width=58) (actual time=0.04..0.08 rows=6 loops=1)
> Index Cond: ((stockid = 1) AND (productid = 234) AND (changeid
> = 1) AND (date <= '2004.06.29'::bpchar))
> Total runtime: 0.25 msec
> ( Compared to 9.17 msec !!!! 37 times faster! )
Good, but you're not there yet --- the Sort step shouldn't be there at
all. You've still got some inconsistency between the ORDER BY and the
index. Check my example again.
regards, tom lane