Function call very slow from JDBC/java but super fast from DBear

From: "An, Hongguo (CORP)" <Hongguo(dot)An(at)ADP(dot)com>
To: "pgsql-performance(at)lists(dot)postgresql(dot)org" <pgsql-performance(at)lists(dot)postgresql(dot)org>
Subject: Function call very slow from JDBC/java but super fast from DBear
Date: 2023-08-08 23:07:04
Message-ID: BYAPR06MB5638AA8D59ED5B075D24B932920DA@BYAPR06MB5638.namprd06.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hi:
I have a function, if I call it from DBeaver, it returns within a minute.

call commonhp.run_unified_profile_load_script_work_assignment_details('BACDHP', 'G3XPM6YE2JHMSQA2');

but if I called it from spring jdbc template, it never comes back:

public void runTransform(String proc, InitDataLoadEntity entity) {

log.info("Initial data finished data migration for {}, starting transform for {}...", entity.getOrganizationOid(), proc);

var schema = clientDbInfo.getSchema(entity.getOrganizationOid())[1].toUpperCase();

var count = unifiedProfileJdbcTemplate.update("call commonhp." + proc + "(?, ?)", schema, entity.getOrganizationOid());

log.info("Initial data finished data migration for {}, end transform for {}, result is {}", entity.getOrganizationOid(), proc, count);

}

The server does show high CPU, the function has mainly just one insert command (batch insert), the target table has 3 FKs.

Please help.
Thanks
Andrew

This message and any attachments are intended only for the use of the addressee and may contain information that is privileged and confidential. If the reader of the message is not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any dissemination of this communication is strictly prohibited. If you have received this communication in error, notify the sender immediately by return email and delete the message and any attachments from your system.

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Dave Cramer 2023-08-09 13:29:42 Re: Function call very slow from JDBC/java but super fast from DBear
Previous Message Dane Foster 2023-08-04 16:41:28 Re: Plan weirdness. A sort produces more rows than the node beneath it