Re: pass in array to function for use by where clause? how optimize?
В списке pgsql-sql по дате отправления:
| От | Rob Sargent |
|---|---|
| Тема | Re: pass in array to function for use by where clause? how optimize? |
| Дата | |
| Msg-id | 4DA5C5CB.3030907@gmail.com обсуждение исходный текст |
| Ответ на | Re: pass in array to function for use by where clause? how optimize? (Tom Lane <tgl@sss.pgh.pa.us>) |
| Ответы |
Re: pass in array to function for use by where clause? how optimize?
|
| Список | pgsql-sql |
On 04/13/2011 09:09 AM, Tom Lane wrote: > 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 > Would adding a subservient function which actually uses the value of the iteration (group_id) as a single parameter be of any use? rjs
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера