Re: 2 Selects 1 is faster, why?

Поиск
Список
Период
Сортировка
От Alvar Freude
Тема Re: 2 Selects 1 is faster, why?
Дата
Msg-id 1371510000.1025105687@gnarzelwicht.delirium-arts.de
обсуждение исходный текст
Ответ на 2 Selects 1 is faster, why?  ("Eric" <emayo@pozicom.net>)
Ответы Re: 2 Selects 1 is faster, why?  (Masaru Sugawara <rk73@sea.plala.or.jp>)
Список pgsql-sql
Hi,

-- Eric <emayo@pozicom.net> wrote:

> If I perform the following 2 selects, the first one is EXTREMELY slow
> where the 2nd one is very fast.

[...] 

> Why would 2 be so much faster?  I have ran the EXPLAIN on this and index
> scans are being used.

I guess, the first query has to search for all ol.orderid the equivalent
o.orderid; the second variant only has to search for '1234' in each
?.orderid, which is much faster.

Explizit joins should speed up this!


> NOTE: The actual queries return more information than this, but the
> fundamental change shown above seems to give me the instant response I am
> looking for. (1) takes about 60 seconds to run and (2) takes 3-5 seconds
> to run.

3-5 seconds seems very long to me, if indexes are used and the result is
not a set of thousands of rows; are you sure?


Ciao Alvar

-- 
// Unterschreiben!      http://www.odem.org/informationsfreiheit/
// Internet am Telefon: http://www.teletrust.info/
// Das freieste Medium? http://www.odem.org/insert_coin/
// Blaster:             http://www.assoziations-blaster.de/





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

Предыдущее
От: "Rajesh Kumar Mallah."
Дата:
Сообщение: Re: sequence chages after firing update
Следующее
От: Gunther Schadow
Дата:
Сообщение: Possibility of Index-Only access in PostgreSQL?