Re: for/loop performance in plpgsql ?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: for/loop performance in plpgsql ?
Дата
Msg-id 17928.1037683436@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: for/loop performance in plpgsql ?  (Federico <fepede@inwind.it>)
Ответы Re: for/loop performance in plpgsql ?  (Federico /* juri */ Pedemonte <fepede@inwind.it>)
Список pgsql-performance
Federico <fepede@inwind.it> writes:
>> Well - the query might well be pre-parsed which means it wouldn't notice any
>> updated stats. Can you provide an example of your code?

> It's nothing particular strange. It's something like :

> result record;

> for result in select rai, tem
>                 from data
>                 where (codice LIKE cod_staz and
>                 ora > orain and
>                 ora <= orafin) loop

Which of these names are columns of the selected tables, and which ones
are plpgsql variables?

The planner has to fall back to default selectivity estimates when it's
looking at queries involving plpgsql variables (since it can't know
their actual values in advance).  I suspect your problem is related to
an inaccurate default estimate.

            regards, tom lane

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

Предыдущее
От: Robert Treat
Дата:
Сообщение: Re: selects from large tables
Следующее
От: Federico /* juri */ Pedemonte
Дата:
Сообщение: Re: for/loop performance in plpgsql ?