[PERFORM] Recursive query gets slower when adding an index

2012-10-19 Thread Thomas Kellerer
Hi, I have a self-referencing table that defines a hierarchy of projects and sub-projects. This is the table definition: CREATE TABLE project ( project_idinteger primary key, project_name text, pl_name text, parent_id integer ); ALTER TABLE project ADD CONSTRAINT

Re: [PERFORM] Recursive query gets slower when adding an index

2012-10-19 Thread Tom Lane
Thomas Kellerer spam_ea...@gmx.net writes: This is the execution plan without index: http://explain.depesz.com/s/ecCT When I create an index on parent_id execution time increases to something between 110ms and 130ms This is the execution plan with index: http://explain.depesz.com/s/xiL The

Re: [PERFORM] Recursive query gets slower when adding an index

2012-10-19 Thread Thomas Kellerer
Tom Lane wrote on 19.10.2012 16:20: Thomas Kellerer spam_ea...@gmx.net writes: This is the execution plan without index: http://explain.depesz.com/s/ecCT When I create an index on parent_id execution time increases to something between 110ms and 130ms This is the execution plan with index: