Re: Re: Does PostgreSQL support EXISTS?

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Re: Does PostgreSQL support EXISTS?
Дата
Msg-id 20010613195011.A31062@svana.org
обсуждение исходный текст
Ответ на Re: Re: Does PostgreSQL support EXISTS?  (Michael Meskes <meskes@postgresql.org>)
Список pgsql-general
On Wed, Jun 13, 2001 at 09:21:02AM +0200, Michael Meskes wrote:
> On Wed, Jun 13, 2001 at 12:23:15PM +1000, Martijn van Oosterhout wrote:
> > select x from a where v in (select v from b)
> > select x from a where exists (select 1 from b where a.v = b.v)
>
> The latter should be faster than the former on every relational database
> system.

Huh? Since they do the same thing should they (in theory) run in the same
time.

Now, I can imagine most DBMSs would optimes the latter better than the
forward, but that doesn't change the theory. In theory someone should be
able to program postgres' rule rewrite to rewrite the former to the latter
and then they would execute identically.
--
Martijn van Oosterhout <kleptog@svana.org>
http://svana.org/kleptog/

В списке pgsql-general по дате отправления:

Предыдущее
От: Allan Kamau
Дата:
Сообщение: PLPGSQL: Using Transactions and locks
Следующее
От: Grzegorz Mucha
Дата:
Сообщение: Extracting database metadata