Re: Different query plans when running through application

Поиск
Список
Период
Сортировка
От Craig James
Тема Re: Different query plans when running through application
Дата
Msg-id CAFwQ8rei42VCE1ohcXB2-kzRMqJtC3nbkYeXT8UmULgxtkui9A@mail.gmail.com
обсуждение исходный текст
Ответ на Different query plans when running through application  (srinivas oguri <srinivasoguri7@gmail.com>)
Список pgsql-admin
You should be more specific -- show the Java code that you are using. My guess (and I'm not an expert) is that you're using a Java variable binding of some sort that causes the planner to create a plan without knowing what the specific values are that are being bound to the SQL. When you execute the plan in psql, you're putting the values directly in so the planner can figure it out.

But without seeing your Java code, it's just a wild guess.

Craig

On Tue, Oct 29, 2019 at 6:46 AM srinivas oguri <srinivasoguri7@gmail.com> wrote:
Hi team,

We have seen a query running from application(Java based) is taking wrong plan. It is a partitioned table, when the query is executed it is scanning all partitions. When I execute the query manually from psql it is scanning the right partition. 

1. Stats are up to date (we have scheduled a hourly job to analyze the table partitions which are used in the query along with tuning autovacuum process).
2. We are using Amazon aurora with 9.6.9 version.

Please help me in troubleshooting this.

Thanks
Srinivas


--
---------------------------------
Craig A. James
Chief Technology Officer
eMolecules, Inc.
3430 Carmel Mountain Road, Suite 250
San Diego, CA 92121
---------------------------------

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

Предыдущее
От: srinivas oguri
Дата:
Сообщение: Different query plans when running through application
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: the difference between psql , createdb, dropuser