Stephen Frost <[EMAIL PROTECTED]> 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); QUERY PLAN ----------------------------------------------------------------------------------- Nested Loop (cost=1.06..31.20 rows=5 width=244) -> HashAggregate (cost=1.06..1.11 rows=5 width=4) -> Seq Scan on int4_tbl (cost=0.00..1.05 rows=5 width=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 ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings