Re: [PERFORM] Why so slow?

2012-02-17 Thread Ants Aasma
On Feb 17, 2012 8:35 PM, "Alessandro Gagliardi" wrote: > Here is the EXPLAIN: http://explain.depesz.com/s/ley > > I'm using PostgreSQL 9.0.6 on i486-pc-linux-gnu, compiled by GCC gcc-4.4.real (Ubuntu 4.4.3-4ubuntu5) 4.4.3, 32-bit > > My random_page_cost is 2 and yet it still insists on using Seq S

Re: [PERFORM] Why so slow?

2012-02-17 Thread Alessandro Gagliardi
Your guess about the seen_its table growing is accurate and applies to the blocks table as well. Partitioning on date is probably a good idea and something that I've been meaning to investigate. I'm not surprised that the JOIN makes it slower, I'm surprised by the magnitude of how much slower it is

Re: [PERFORM] Why so slow?

2012-02-17 Thread Steve Crawford
On 02/17/2012 10:34 AM, Alessandro Gagliardi wrote: Comparing SELECT DISTINCT(user_id) FROM blocks JOIN seen_its USING (user_id) WHERE seen_its.created BETWEEN (now()::date - interval '8 days')::timestamp AND now()::date::timestamp to SELECT DISTINCT(user_id) FROM seen_its WHERE created BETWEE

[PERFORM] Why so slow?

2012-02-17 Thread Alessandro Gagliardi
Comparing SELECT DISTINCT(user_id) FROM blocks JOIN seen_its USING (user_id) WHERE seen_its.created BETWEEN (now()::date - interval '8 days')::timestamp AND now()::date::timestamp to SELECT DISTINCT(user_id) FROM seen_its WHERE created BETWEEN (now()::date - interval '8 days')::timestamp AND now():