Re: [PERFORM] Slow query on CLUTER -ed tables

2011-03-25 Thread Laszlo Nagy
I suspect that, since the matched hid's probably aren't sequential, many of those ~500 product_price_offer_history rows will be far apart on disk. OMG I was a fool! I'll CLUSTER on a different index and it will be fast, I'm sure. Thanks! L -- Sent via pgsql-performance mailing list

[PERFORM] Slow query on CLUTER -ed tables

2011-03-23 Thread Laszlo Nagy
Given two tables: CREATE TABLE product_price_history ( hid bigint NOT NULL, hdate timestamp without time zone NOT NULL, id bigint NOT NULL, product_id bigint NOT NULL, more columns here CONSTRAINT pk_product_price_history PRIMARY KEY (hid); CREATE INDEX

Re: [PERFORM] Slow query on CLUTER -ed tables

2011-03-23 Thread Marti Raudsepp
2011/3/23 Laszlo Nagy gand...@shopzeus.com: GroupAggregate  (cost=5553554.25..5644888.17 rows=2283348 width=50)  -  Sort  (cost=5553554.25..5559262.62 rows=2283348 width=50)        Sort Key: pph.hid, ppoh.merchantid, pph.hdate        -  Nested Loop  (cost=0.00..5312401.66 rows=2283348