From: Linos <info@linos.es>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-performance@postgresql.org
Subject: Re: CTE vs Subquery
Date: Tue, 25 Oct 2011 18:47:53 +0200
Message-ID: <4EA6E839.6050804@linos.es> (raw)
In-Reply-To: <24672.1319561025@sss.pgh.pa.us>
References: <4EA6E252.6030002@linos.es>
<24672.1319561025@sss.pgh.pa.us>
El 25/10/11 18:43, Tom Lane escribió:
> Linos <info@linos.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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: info@linos.es, tgl@sss.pgh.pa.us
Subject: Re: CTE vs Subquery
In-Reply-To: <4EA6E839.6050804@linos.es>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox