Re: pass in array to function for use by where clause? how optimize?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: pass in array to function for use by where clause? how optimize?
Дата
Msg-id 5079.1302707363@sss.pgh.pa.us
обсуждение исходный текст
Ответ на pass in array to function for use by where clause? how optimize?  (Anish Kejariwal <anishkej@gmail.com>)
Ответы Re: pass in array to function for use by where clause? how optimize?
Список pgsql-sql
Anish Kejariwal <anishkej@gmail.com> writes:
> (select store_id, avg(sales) sales
> from store
> where group_id in(select $1[i] from generate_subscripts($1, 1) g(i))

Seems like a pretty brute-force way to deal with the array.  Try

where group_id = any($1)

Not sure if it'll be a great deal faster, but it's at least easier to
write.
        regards, tom lane


В списке pgsql-sql по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: unnesting of array of different size explodes memory
Следующее
От: Rob Sargent
Дата:
Сообщение: Re: pass in array to function for use by where clause? how optimize?