Re: CTE vs Subquery

From: Linos <info(at)linos(dot)es>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: CTE vs Subquery
Date: 2011-10-25 16:47:53
Message-ID: 4EA6E839.6050804@linos.es
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

El 25/10/11 18:43, Tom Lane escribió:
> Linos <info(at)linos(dot)es> 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.
>
> regards, tom lane
>

The truth it is that complex queries seems more readable using them (maybe a
personal preference no doubt).

Do have other popular databases the same behavior? SQL Server or Oracle for example?

Regards,
Miguel Ángel.

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Merlin Moncure 2011-10-25 17:11:23 Re: CTE vs Subquery
Previous Message Tom Lane 2011-10-25 16:43:45 Re: CTE vs Subquery