From: | "Greg Stark" <greg(dot)stark(at)enterprisedb(dot)com> |
---|---|
To: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Gaetano Mendola" <mendola(at)bigfoot(dot)com> |
Cc: | <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Limit changes query plan |
Date: | 2008-02-01 16:04:58 |
Message-ID: | 51494DB187D98F4C88DBEBF1F5F6D42303A1E503@edb06.mail01.enterprisedb.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> -> Index Scan using i_oa_2_00_dt_for on t_oa_2_00_dt dt (cost=0.00..5.31 rows=1 width=8) (actual time=1.264..1.264 rows=0 loops=50)
> Index Cond: (dt.card_id = c.id)
> Filter: ((_to >= 1500) AND (_from <= 1550))
> Total runtime: 3399960.277 ms
Also, are 1500 and 1550 user-supplied parameters or are they part of a small set of possible values? You could consider having a partial index on "card_id WHERE _to >= 1500 AND _from <= 1550". The numbers don't even have to match exactly as long as they include all the records the query needs.
Another possibility is using something like "cube" from contrib to build a GIST index on <_to,_from>. I think you would need to load gist_btree as well for the first column on card_id. It doesn't help every use case though, you would have to experiment.
But before experimenting with either of those things, what does "VACUUM VERBOSE t_oa_2_00_dt" say?
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Gilligan | 2008-02-01 16:14:45 | BUG #3921: CREATE TABLE / INCLUDING INDEXES fails with permission denied |
Previous Message | Tom Lane | 2008-02-01 16:01:56 | Re: FW: bitemporal functionality for PostgreSQL |