Re: [PERFORM] Query much slower when run from postgres function

Список
Период
Сортировка
От Mario Splivalo
Тема Re: [PERFORM] Query much slower when run from postgres function
Дата
Msg-id 49B56D4D.9090605@megafon.hr
обсуждение исходный текст
Ответ на Re: [PERFORM] Query much slower when run from postgres function  (Guillaume Cottenceau)
Список pgsql-jdbc
Дерево обсуждения
Re: [PERFORM] Query much slower when run from postgres function  (Guillaume Cottenceau, )
 Re: [PERFORM] Query much slower when run from postgres function  (Guillaume Smet, )
  Re: [PERFORM] Query much slower when run from postgres function  (Tom Lane, )
   Re: [PERFORM] Query much slower when run from postgres function  (Andreas Wenk, )
   Re: [PERFORM] Query much slower when run from postgres function  (Dave Cramer, )
    Re: [PERFORM] Query much slower when run from postgres function  (James Mansion, )
    Re: [PERFORM] Query much slower when run from postgres function  (Oliver Jowett, )
     Re: [PERFORM] Query much slower when run from postgres function  (Guillaume Cottenceau, )
      Re: [PERFORM] Query much slower when run from postgres function  (Oliver Jowett, )
       Re: [PERFORM] Query much slower when run from postgres function  (Guillaume Cottenceau, )
        Re: [PERFORM] Query much slower when run from postgres function  (Kris Jurka, )
  Re: [PERFORM] Query much slower when run from postgres function  (Scott Carey, )
   Re: [PERFORM] Query much slower when run from postgres function  (Oliver Jowett, )
    Re: [PERFORM] Query much slower when run from postgres function  (Scott Carey, )
 Re: [PERFORM] Query much slower when run from postgres function  (Mario Splivalo, )
Guillaume Cottenceau wrote:
>>> Now I'm confused, why is 'sql' function much slower than 'direct' SELECT?
>> Usually the reason for this is that the planner chooses a different plan
>> when it has knowledge of the particular value you are searching for than
>> when it does not.
>
> Yes, and since Mario is coming from JDBC, I'll share my part on
> this: I also noticed some very wrong plans in JDBC because of the
> "optimization" in prepared statements consisting of planning once
> for all runs, e.g. without any parameter values to help planning.
>

For what is worth:

When I call postgres function via JDBC, I have almost the same execution
time as when calling function from psql.

When I call SELECT COUNT(*)... WHERE... query from JDBC, I again have
almost the same execution time as when executing query from psql.

Postgres function takes around 200ms, and SELECT query takes around 2-4ms.

    Mike

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

Предыдущее
От: Kris Jurka
Дата:
Сообщение: Re: getGeneratedKeys
Следующее
От: "Dickson S. Guedes"
Дата:
Сообщение: Renaming sequence auto generated by SERIAL type don't update pg_attrdef