Re: [PERFORM] CTE vs Subquery

2011-10-26 Thread Linos
El 26/10/11 14:23, Merlin Moncure escribió: > On Wed, Oct 26, 2011 at 4:00 AM, Linos wrote: >> El 25/10/11 19:11, Merlin Moncure escribió: >>> On Tue, Oct 25, 2011 at 11:47 AM, Linos wrote: El 25/10/11 18:43, Tom Lane escribió: > Linos writes: >> i am having any problems with pe

Re: [PERFORM] CTE vs Subquery

2011-10-26 Thread Merlin Moncure
On Wed, Oct 26, 2011 at 4:00 AM, Linos wrote: > El 25/10/11 19:11, Merlin Moncure escribió: >> On Tue, Oct 25, 2011 at 11:47 AM, Linos wrote: >>> El 25/10/11 18:43, Tom Lane escribió: Linos writes: >     i am having any problems with performance of queries that uses CTE, > can the

Re: [PERFORM] CTE vs Subquery

2011-10-26 Thread Linos
El 25/10/11 19:11, Merlin Moncure escribió: > On Tue, Oct 25, 2011 at 11:47 AM, Linos wrote: >> El 25/10/11 18:43, Tom Lane escribió: >>> Linos writes: i am having any problems with performance of queries that uses CTE, can the join on a CTE use the index of the original table

Re: [PERFORM] CTE vs Subquery

2011-10-25 Thread Merlin Moncure
On Tue, Oct 25, 2011 at 11:47 AM, Linos wrote: > El 25/10/11 18:43, Tom Lane escribió: >> Linos writes: >>>     i am having any problems with performance of queries that uses CTE, can >>> the >>> join on a CTE use the index of the original table? >> >> CTEs act as optimization fences.  This is a

Re: [PERFORM] CTE vs Subquery

2011-10-25 Thread Linos
El 25/10/11 18:43, Tom Lane escribió: > Linos writes: >> i am having any problems with performance of queries that uses CTE, can >> the >> join on a CTE use the index of the original table? > > CTEs act as optimization fences. This is a feature, not a bug. Use > them when you want to isola

Re: [PERFORM] CTE vs Subquery

2011-10-25 Thread Tom Lane
Linos writes: > i am having any problems with performance of queries that uses CTE, can > the > join on a CTE use the index of the original table? CTEs act as optimization fences. This is a feature, not a bug. Use them when you want to isolate the evaluation of a subquery.

[PERFORM] CTE vs Subquery

2011-10-25 Thread Linos
Hi all, i am having any problems with performance of queries that uses CTE, can the join on a CTE use the index of the original table?, suppose two simple tables: CREATE TABLE employee ( emp_id integer NOT NULL, name character varying NOT NULL, CONSTRAINT employee_pkey PRIMARY KEY (emp_i