[GENERAL] Re: [GENERAL] Puzzling table scan in a CTE

2013-11-25 Thread slapo
I apologise for the late response.   I've increased "effective_cache_size" to 50% and tried again - no change. Afterwards, I've increased "cpu_tuple_cost" from 0.02 to 0.05 and tried again - no change.   What is most curious to me is that I think the initial result set is very small, so any JOIN

[GENERAL] Re: [GENERAL] Puzzling table scan in a CTE

2013-11-25 Thread slapo
Sorry for the delay, but I didn't have access to the database during the weekend.   Here's the output of "explain (analyze, buffers)": http://explain.depesz.com/s/scC   I'm also curious why it actually seems to touch the table assuming there are output columns which I haven't defined anywhere (s

[GENERAL] Re: [GENERAL] Puzzling table scan in a CTE

2013-11-22 Thread slapo
Thanks for the suggestion. I've tried it with seqscan set to off, but there's still a bitmap heap scan going on: http://explain.depesz.com/s/zIJl   I have random_page_cost set to 1.5 at the moment, as the database is on a solid state disk.   Every user has a parent, but not every parent has a ch

[GENERAL] Puzzling table scan in a CTE

2013-11-22 Thread slapo
Good day,   I have a recursive CTE where a table scan occurs, even though there doesn't seem to be a good reason for it. It seems the planner came to the conclusion that columns that are not actually used in the output, joins or a where clause are a part of the output. It's not a performance pro