Re: rw_redis_fdw: SQL Errors when statement is within a function

Поиск
Список
Период
Сортировка
Искать
От
Christoph Moench-Tegeder
Тема
Re: rw_redis_fdw: SQL Errors when statement is within a function
Дата
Msg-id
20181026212725.33rqwraa73wpzq5f@squirrel.exwg.net
Ответ на
Список
Дерево обсуждения
rw_redis_fdw: SQL Errors when statement is within a function GPT <gptmailinglists@gmail.com>
Re: rw_redis_fdw: SQL Errors when statement is within a function Andres Freund <andres@anarazel.de>
Re: rw_redis_fdw: SQL Errors when statement is within a function GPT <gptmailinglists@gmail.com>
Re: rw_redis_fdw: SQL Errors when statement is within a function Christoph Moench-Tegeder <cmt@burggraben.net>
Re: rw_redis_fdw: SQL Errors when statement is within a function GPT <gptmailinglists@gmail.com>
Re: rw_redis_fdw: SQL Errors when statement is within a function Christoph Moench-Tegeder <cmt@burggraben.net>
Re: rw_redis_fdw: SQL Errors when statement is within a function GPT <gptmailinglists@gmail.com>
Re: rw_redis_fdw: SQL Errors when statement is within a function Christoph Moench-Tegeder <cmt@burggraben.net>
Re: rw_redis_fdw: SQL Errors when statement is within a function Adrian Klaver <adrian.klaver@aklaver.com>
Re: rw_redis_fdw: SQL Errors when statement is within a function GPT <gptmailinglists@gmail.com>
Re: rw_redis_fdw: SQL Errors when statement is within a function Adrian Klaver <adrian.klaver@aklaver.com>
Re: rw_redis_fdw: SQL Errors when statement is within a function GPT <gptmailinglists@gmail.com>
Re: rw_redis_fdw: SQL Errors when statement is within a function Christoph Moench-Tegeder <cmt@burggraben.net>
Re: rw_redis_fdw: SQL Errors when statement is within a function GPT <gptmailinglists@gmail.com>
Re: rw_redis_fdw: SQL Errors when statement is within a function Christoph Moench-Tegeder <cmt@burggraben.net>
Re: rw_redis_fdw: SQL Errors when statement is within a function Adrian Klaver <adrian.klaver@aklaver.com>
Re: rw_redis_fdw: SQL Errors when statement is within a function GPT <gptmailinglists@gmail.com>
Re: rw_redis_fdw: SQL Errors when statement is within a function Adrian Klaver <adrian.klaver@aklaver.com>
Re: rw_redis_fdw: SQL Errors when statement is within a function GPT <gptmailinglists@gmail.com>
Re: rw_redis_fdw: SQL Errors when statement is within a function Adrian Klaver <adrian.klaver@aklaver.com>
Re: rw_redis_fdw: SQL Errors when statement is within a function GPT <gptmailinglists@gmail.com>
Re: rw_redis_fdw: SQL Errors when statement is within a function Adrian Klaver <adrian.klaver@aklaver.com>
Re: rw_redis_fdw: SQL Errors when statement is within a function GPT <gptmailinglists@gmail.com>
Re: rw_redis_fdw: SQL Errors when statement is within a function GPT <gptmailinglists@gmail.com>
Re: rw_redis_fdw: SQL Errors when statement is within a function Adrian Klaver <adrian.klaver@aklaver.com>
## GPT (gptmailinglists@gmail.com):

> I have searched in
> https://github.com/nahanni/rw_redis_fdw/blob/master/redis_fdw.c for
> PREPARE and EXECUTE keywords. There are not any of them, except in
> comments.

Of course not - the FDW does not execute SQL on the PostgreSQL side,
but sends commands to redis.
Still, the FDW operations are part of PostgreSQL's query plan; they
have to be - everything PostgreSQL does is organized in plans, and the
operations done on the Foreign Server (redis in this case) have to
have their interfaces in the plan.

And the important thing is: there is no guarantee that the same SQL
statement will always execute with the same plan: One reason would be
changing table statistics, another is when PostgreSQL switches to
the generic plan for a prepared statement. Your case looks like the
latter, especially the observation "After that (6th time)" in
https://github.com/nahanni/rw_redis_fdw/issues/13#issuecomment-428670890
hints to that.
So, where does that prepared statement come from? You don't really
describe your environment... It's unlikely that you're calling PREPARE
yourself - but some drivers are notorious for that (Perl DBI's
$dbh->prepare() or JDBC's PreparedStatement come to mind), and
even PL/pgSQL uses prepared statements internally:
https://www.postgresql.org/docs/11/static/plpgsql-implementation.html#PLPGSQL-PLAN-CACHING

So: plans are not stable between query executions, and you may have
prepared statements without knowing that.

Regards,
Christoph

-- 
Spare Space.

В списке pgsql-general по дате отправления
От: Thomas Munro
Дата:
От: Jeff Janes
Дата:
FAQ