Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fYC87-0004S0-Ak for pgsql-general@arkaria.postgresql.org; Wed, 27 Jun 2018 15:13:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fYC84-0002oN-V8 for pgsql-general@arkaria.postgresql.org; Wed, 27 Jun 2018 15:13:08 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fYC84-0002oA-FJ for pgsql-general@lists.postgresql.org; Wed, 27 Jun 2018 15:13:08 +0000 Received: from mail-oln040092253054.outbound.protection.outlook.com ([40.92.253.54] helo=APC01-SG2-obe.outbound.protection.outlook.com) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fYC7z-0008Kq-T5 for pgsql-general@lists.postgresql.org; Wed, 27 Jun 2018 15:13:06 +0000 Received: from HK2APC01FT022.eop-APC01.prod.protection.outlook.com (10.152.248.56) by HK2APC01HT153.eop-APC01.prod.protection.outlook.com (10.152.249.212) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.906.15; Wed, 27 Jun 2018 15:12:59 +0000 Received: from MAXPR0101MB1915.INDPRD01.PROD.OUTLOOK.COM (10.152.248.52) by HK2APC01FT022.mail.protection.outlook.com (10.152.248.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.906.15 via Frontend Transport; Wed, 27 Jun 2018 15:12:59 +0000 Received: from MAXPR0101MB1915.INDPRD01.PROD.OUTLOOK.COM ([fe80::11c4:7785:cb4d:2ab2]) by MAXPR0101MB1915.INDPRD01.PROD.OUTLOOK.COM ([fe80::11c4:7785:cb4d:2ab2%8]) with mapi id 15.20.0884.024; Wed, 27 Jun 2018 15:12:59 +0000 From: amandeep singh To: "pgsql-general@lists.postgresql.org" , Edson Carlos Ericksson Richter Subject: Re: We find few queries running three times simultaneously with same parameters on postgres db Thread-Topic: We find few queries running three times simultaneously with same parameters on postgres db Thread-Index: AQHUDTa3rR0BWzEAVU+yhcnY6K8nraRyV5sAgAAhxICAAFHE64ABWVuAgAARX/o= Date: Wed, 27 Jun 2018 15:12:59 +0000 Message-ID: References: , In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:F4947E898D3CCBD6E87D63229B3DAE0DC565C69751B93243DA70E21FA21B6F44;UpperCasedChecksum:8FD51943A77E2D4B0C4D2AF0285B41610A34E8E3AAFB8B1C3A97E11DDE56BA0D;SizeAsReceived:7525;Count:46 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [gKiRJCO+rGnKCp/X/Nj0T+YGGVERsuO1] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;HK2APC01HT153;7:Vvnvjz5x39vclRdRhR+tnJalJJA/YuF9PytEiUJkw/YaPzLz8NYsUaF4f1I06zL63S9eqaGsd2+6LUKt5yRsqmjJ/+lmilDUMoJVnvWShxWUm+5z0OQ++cArqmoCIhhAD007jS/Y3KUHrKTJMXEW/n8bJsJdivO3KU4lfHPRBy83306X00RKKfrnVjayHqMw59gOb5jVafC5+ASq1jt1I1a+hHWyhA1zYsMHzS7zEDCpJtQQtGfuvVWFGfM1inh+ x-incomingheadercount: 46 x-eopattributedmessage: 0 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(201702061078)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031324274)(2017031323274)(2017031322404)(1603101448)(1601125500)(1701031045);SRVR:HK2APC01HT153; x-ms-traffictypediagnostic: HK2APC01HT153: x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(444000031);SRVR:HK2APC01HT153;BCL:0;PCL:0;RULEID:;SRVR:HK2APC01HT153; x-forefront-prvs: 0716E70AB6 x-forefront-antispam-report: SFV:NSPM;SFS:(7070007)(129404003)(189003)(199004)(8676002)(26005)(99286004)(486006)(81156014)(6346003)(446003)(2501003)(5250100002)(53546011)(74316002)(2900100001)(8936002)(6506007)(476003)(74482002)(11346002)(7696005)(76176011)(110136005)(14444005)(93886005)(256004)(97736004)(236005)(86362001)(105586002)(82202002)(104016004)(106356001)(9686003)(86152003)(6246003)(55016002)(54896002)(6306002)(606006)(14454004)(229853002)(68736007)(25786009)(102836004)(45080400002)(5660300001)(33656002)(6436002)(80872002);DIR:OUT;SFP:1901;SCL:1;SRVR:HK2APC01HT153;H:MAXPR0101MB1915.INDPRD01.PROD.OUTLOOK.COM;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:; received-spf: None (protection.outlook.com: live.in does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=singh_a@live.in; x-microsoft-antispam-message-info: VKaAKirJeIywIdC7G2Dw+Y8vhCAWiQCNypLPExg/h3fvshe+fcqfznJs8O4EXg+eWys6CIW5CzpnFM63JkmCi2zS4ca3hSGfYzi+apoJTCoAJfi5BgHt+gGVBP1WhXT7CcMi7XQvUld8TWY2yycZpqOYLRDPi+cp77vSVk63jo/pIdTRaGg67YHVyUk4qOYSb64KC6J8BtmFz918esBi3xCKaZeDpQ4grbRsydpCdjU= Content-Type: multipart/alternative; boundary="_000_MAXPR0101MB1915FEE2A4BC0B7B8DA71F1880480MAXPR0101MB1915_" MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 7181d4b0-87d6-4f4e-ba33-0d3746212cec X-MS-Exchange-CrossTenant-Network-Message-Id: 6e230fd7-795f-4b66-4b24-08d5dc407807 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 7181d4b0-87d6-4f4e-ba33-0d3746212cec X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Jun 2018 15:12:59.1773 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK2APC01HT153 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --_000_MAXPR0101MB1915FEE2A4BC0B7B8DA71F1880480MAXPR0101MB1915_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Thanks Edson for ur support. As I am not a developer , I will share this test case with development team= . Once I get feedback from team, will share it on this mailing list. Get Outlook for Android From: Edson Carlos Ericksson Richter Sent: Wednesday, June 27, 2018 2:02:19 PM To: pgsql-general@lists.postgresql.org Subject: Re: We find few queries running three times simultaneously with sa= me parameters on postgres db Em 26/06/2018 14:26, amandeep singh escreveu: > Hi Andreas > > The value for $1 is same in all queries. > > @Edson: number of such running queries are always 3. I see. It seems a programming logic error to me. I also use JPA (Hibernate and/or EclipseLink) and I don't have such problem= . But I could replicate your scenario doing the following (with EclipseLink, didn't test with Hibernate): 1) In persistence.xml, disable all caches (this is very important for make reproducible) 2) Load three Person records that live on same city (objects Person and City mapped to tables Person and City, being city an attribute of Person object): TypedQuery qry =3D em.createQuery("select P from Person P where P.city.name =3D :cityname"); qry.setParameter("cityname", "Porto Alegre"); qry.setMaxResults(3); List rs =3D qry.getResultList(); 3) This will cause one query against Person table, and exactly 3 queries issued with same parameters to City table. I really don't know how your code works, and is quite hard to guess, but as you can see, it is easy to reproduce similar behavior. Now, if I enable EclipseLink caches, only one query is issued for each City key - so, I'll have one query for Person and one query for only. Hope this helps to enlighten your problem. :-) Regards, Edson --_000_MAXPR0101MB1915FEE2A4BC0B7B8DA71F1880480MAXPR0101MB1915_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Thanks Edson for ur support.

As I am not a developer , I will share this test case with development team= .

Once I get feedback from team, will share it on this mailing list.

From: Edson C= arlos Ericksson Richter <richter@simkorp.com.br>
Sent: Wednesd= ay, June 27, 2018 2:02:19 PM
To: pgsql-gen= eral@lists.postgresql.org
Subject: Re: = We find few queries running three times simultaneously with same parameters= on postgres db
 
Em 26/06/2018 14:26, amandeep singh escreveu:
> Hi Andreas
>
> The value for $1 is same in all queries.
>
> @Edson: number of such running queries are always  3.

I see. It seems a programming logic error to me.
I also use JPA (Hibernate and/or EclipseLink) and I don't have such problem= .
But I could replicate your scenario doing the following (with
EclipseLink, didn't test with Hibernate):

1) In persistence.xml, disable all caches (this is very important for
make reproducible)
2) Load three Person records that live on same city (objects Person and
City mapped to tables Person and City, being city an attribute of Person
object):

TypedQuery<Person> qry =3D em.createQuery("select P from Person = P where
P.city.name =3D :cityname");
qry.setParameter("cityname", "Porto Alegre");
qry.setMaxResults(3);
List<Person> rs =3D qry.getResultList();

3) This will cause one query against Person table, and exactly 3 queries
issued with same parameters to City table.

I really don't know how your code works, and is quite hard to guess, but
as you can see, it is easy to reproduce similar behavior.
Now, if I enable EclipseLink caches, only one query is issued for each
City key - so, I'll have one query for Person and one query for  only.=

Hope this helps to enlighten your problem.

:-)

Regards,

Edson

--_000_MAXPR0101MB1915FEE2A4BC0B7B8DA71F1880480MAXPR0101MB1915_--