Re: Different query plans when running through application
Craig James <[email protected]> Tue, 29 Oct 2019 08:41:32 -0700
| Newsgroups | gmane.comp.db.postgresql.admin |
|---|---|
| Message-ID | <CAFwQ8rei42VCE1ohcXB2-kzRMqJtC3nbkYeXT8UmULgxtkui9A@mail.gmail.com> |
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 <[email protected]> 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 ---------------------------------