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?
|
Список | 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 по дате отправления: