[SQL] is there a distinct function for comma lists ?

2010-09-07 Thread Andreas
Hi, is there a distinct function for comma separated lists ? I sometimes need to update tables where I got a set of IDs, like: update mytable set someattribute = 42 where mytable.id in ( 1, 2, 3, 5, 7, 11, 3, 6, 13, 13, 3, 11 ... ) So there are double entries in the list but in this case i

Re: [SQL] is there a distinct function for comma lists ?

2010-09-07 Thread Andreas Gaab
Hi, For the problem 1 perhaps something like select distinct unnest(ARRAY[ 1, 2, 3, 5, 7, 11, 3, 6, 13, 13, 3, 11 ]) Regards, Andreas -Ursprüngliche Nachricht- Von: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org] Im Auftrag von Andreas Gesendet: Dienstag, 7. Sept

[SQL] Sequential scan evaluating function for each row, seemingly needlessly

2010-09-07 Thread Bryce Nesbitt
On psql 8.3.9, I ran a limited query limited to 5 results. There was a moderately expensive function call which I expected to be called 5 times, but was apparently called for each row of the sequential scan. Why? preproduction=> explain analyze select url(context_key) from extractq order b

Re: [SQL] Sequential scan evaluating function for each row, seemingly needlessly

2010-09-07 Thread Tom Lane
Bryce Nesbitt writes: > On psql 8.3.9, I ran a limited query limited to 5 results. There was a > moderately expensive function call > which I expected to be called 5 times, but was apparently called for > each row of the sequential scan. Why? Given the plan: > Limit (cost=19654.53..19654.

Re: [SQL] is there a distinct function for comma lists ?

2010-09-07 Thread Lew
On 09/07/2010 07:52 AM, Andreas wrote: Hi, is there a distinct function for comma separated lists ? I sometimes need to update tables where I got a set of IDs, like: update mytable set someattribute = 42 where mytable.id in ( 1, 2, 3, 5, 7, 11, 3, 6, 13, 13, 3, 11 ... ) So there are double ent