Joe Conway <[EMAIL PROTECTED]> writes:

> In 7.4 you could use an array. It would look like this:


Though note that 7.4 doesn't know how to optimize this form:


db=> explain select * from foo where foo_id in (1,2);
                                                   QUERY PLAN                          
                          
-----------------------------------------------------------------------------------------------------------------
 Index Scan using foo_pkey, foo_pkey on foo  (cost=0.00..6.05 rows=2 width=756)
   Index Cond: ((foo_id = 1) OR (foo_id = 2))
(2 rows)


db=> explain select * from foo where foo_id = ANY (array[1,2]);
                              QUERY PLAN                              
----------------------------------------------------------------------
 Seq Scan on foo  (cost=0.00..1132.82 rows=5955 width=756)
   Filter: (foo_id = ANY ('{1,2}'::integer[]))
(2 rows)

-- 
greg


---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Reply via email to