Re: IN(subselect returning few values ...)
| От | Tom Lane | 
|---|---|
| Тема | Re: IN(subselect returning few values ...) | 
| Дата | |
| Msg-id | 25096.1162411866@sss.pgh.pa.us обсуждение исходный текст  | 
		
| Ответ на | IN(subselect returning few values ...) (Stephen Frost <sfrost@snowman.net>) | 
| Ответы | 
                	
            		Re: IN(subselect returning few values ...)
            		
            		 | 
		
| Список | pgsql-hackers | 
Stephen Frost <sfrost@snowman.net> writes:
> Working on 8.1 I've recently been annoyed at the need to translate a
> sub-select inside an IN () clause into a fixed list of contents (the
> results of the sub-select, exactly) in order to get better performance.
Better performance than what?  Ever since 7.4 we've converted small IN
sub-selects into plans along the lines of
regression=# explain select * from tenk1 where unique1 in (select f1 from int4_tbl);
QUERYPLAN
 
-----------------------------------------------------------------------------------Nested Loop  (cost=1.06..31.20
rows=5width=244)  ->  HashAggregate  (cost=1.06..1.11 rows=5 width=4)        ->  Seq Scan on int4_tbl  (cost=0.00..1.05
rows=5width=4)  ->  Index Scan using tenk1_unique1 on tenk1  (cost=0.00..6.00 rows=1 width=244)        Index Cond:
(tenk1.unique1= "outer".f1)
 
(5 rows)
which looks OK to me.
        regards, tom lane
		
	В списке pgsql-hackers по дате отправления: