Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iK1DW-00075I-U3 for pgsql-general@arkaria.postgresql.org; Mon, 14 Oct 2019 14:20:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iK19w-0001AE-3Z for pgsql-general@arkaria.postgresql.org; Mon, 14 Oct 2019 14:17:16 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iK18j-00018R-Fu for pgsql-general@lists.postgresql.org; Mon, 14 Oct 2019 14:16:02 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iK18a-0000nI-Ex for pgsql-general@postgresql.org; Mon, 14 Oct 2019 14:16:00 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id F23C3221BC; Mon, 14 Oct 2019 10:15:49 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Mon, 14 Oct 2019 10:15:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=E DAXsErNHNPbFihAmeBQM2+dqfFJitZ0Cd1BBUpnZtk=; b=u9/bolf+dwMmbopuy buZKaO6Iqq70NgHP/kemzRePX30vnFWla3CQ13JQr6s2+cTX7zFcZEmkCcx7Nqv7 0Mt2D/5gJao8IHjwoydWJbCyeSKZal6ggNAVeQyR/0XNEbsr0MDrhOXENVqmchqi 9Vzt5PcB217qmzA7mug0x5Md87gBEihnVnIFgaJ7zW5C2ltutxJoRfSnMIunzxqn 5YjUFISaIUPrM9ldvSRIg8egIDUefqZh1A0Lv0DJ8qP/uLhx8jXxicuoFdReFXiN gTvdmefUL9FQvXtdKvxiW4urksMT2wO20aU245CR4JhSeBgodSSioZRFhCWJ5i3d /9EGg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=EDAXsErNHNPbFihAmeBQM2+dqfFJitZ0Cd1BBUpnZ tk=; b=opRl8FhT46l2JEWrSPUHPViPG+cB46olVjcmCwvA2uCebGnFIjTKjIPFD mPaGzwy7kjLaJVKwtvpqgr+Ww5BTO307AIC+DekLO4uk1Myaq6HlOKSC4EZw2dx1 ykhjm7rMPJB391xg1rozsZ8wPNmuyKE4CAll8JIbQ34xPuLN1YLEN7SXGRY060S3 UIUXCrNBTXX1xpEsM1EJa8znRUBbuBUP5Uy94Kj6bOFhrEagE/wDoqRD29Gf2ySF 5WlJZFojwSk2uVykREi6uhCu7phoXdo3K9sO3ykiyK1Yzl46uXP1/f4NaTlmzH26 S4+TQNVHXxpT+6Qt146krvBMlBf1A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrjedugdejhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepuffvfhfhkffffgggjggtgfesthekre dttdefjeenucfhrhhomheptegurhhirghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhl rghvvghrsegrkhhlrghvvghrrdgtohhmqeenucffohhmrghinhepphhoshhtghhrvghsqh hlrdhorhhgpdhsthgrtghkohhvvghrfhhlohifrdgtohhmnecukfhppedujeegrddvuddr udefhedrvddtieenucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhklhgrvh gvrhesrghklhgrvhgvrhdrtghomhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from [192.168.1.2] (174-21-135-206.tukw.qwest.net [174.21.135.206]) by mail.messagingengine.com (Postfix) with ESMTPA id 1EC63D6005D; Mon, 14 Oct 2019 10:15:49 -0400 (EDT) Subject: Re: Too many SET TimeZone and Application_name queries To: Amarendra Konda Cc: pgsql-general@postgresql.org References: From: Adrian Klaver Message-ID: <13e53c1b-0ad7-d975-8f79-2e7413afbc87@aklaver.com> Date: Mon, 14 Oct 2019 07:15:48 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 10/13/19 10:24 PM, Amarendra Konda wrote: > Hi Adrian, > > Thanks a lot for the response. > > We are using JDBC Driver 42.2.8 along with the Tomcat Server on Java 8. > As part of application code, We are *_not_* setting timezone (or) > application names. One observation was, application was querying columns > of the datatype "timestamp without time zone" . Well something is explicitly setting the TimeZone. Per this: https://stackoverflow.com/questions/18447995/postgresql-9-2-jdbc-driver-uses-client-time-zone I would start with the JDBC driver. You might also try the Postgres JDBC list: https://www.postgresql.org/list/pgsql-jdbc/ Re: application_name. I do not see SET for this when I connect using application_name as part of connection string: psql "host=localhost dbname=postgres user=postgres application_name=psql_client" [unknown]-[unknown]-2019-10-14 07:06:35.508 PDT-0LOG: connection received: host=::1 port=46246 [unknown]-postgres-2019-10-14 07:06:35.530 PDT-0LOG: connection authorized: user=postgres database=postgres SSL enabled (protocol=TLSv1.2, cipher=ECDHE-RSA-AES256-GCM-SHA384, bits=256, compression=off) So I believe this is being explicitly SET by something. Since 'PostgreSQL JDBC Driver' is the Postgres JDBC driver name I would start there. > > Regards, Amarendra > > > On Fri, Oct 11, 2019 at 7:33 PM Adrian Klaver > wrote: > > On 10/11/19 4:49 AM, Amarendra Konda wrote: > > Hi, > > > > In our test environment, it was observed that there are too many > queries > > were getting fired to the database server, even though they are > not part > > of the SQL query execution. > > > > And the number of queries that were coming to server are very > high. Can > > you please suggest on how to avoid these queries to the database > server ? > > My guess is your application server/framework is setting the below. > What are you using for above? > > > > > > > 2019-10-10 13:37:25 UTC:172.31.77.194(36920): > > user1@new_unity_green1:[2549]:LOG:  duration: 0.081 ms >  statement: *SET > > application_name='PostgreSQL JDBC Driver';* > > 2019-10-10 13:37:25 UTC:172.31.69.112(45682): > > user1@new_unity_green0:[3545]:LOG:  duration: 0.036 ms >  statement: *SET > > TimeZone='UTC';* > > 2019-10-10 13:37:25 > > UTC:172.31.77.194(36902):user1@new_unity_green1:[2112]:LOG: >  duration: > > 0.177 ms  statement: *SET TimeZone='Etc/UTC';SET > > application_name='PostgreSQL JDBC Driver';* > > > > > > *_Environment_* > > > >   * PGBouncer 1.9 > >   * JDBC Driver 42.2.8 > >   * Java 1.8 > >   * PostgreSQL 9.6.2 on x86_64-pc-linux-gnu, compiled by gcc > (GCC) 4.8.3 > >     20140911 (Red Hat 4.8.3-9), 64-bit > > > > > > Application Server, pgBouncer and database server are all configured > > with UTC only. > > > > =>show timezone; > >   TimeZone > > ---------- > >   UTC > > > > Thanks in advance, > > > > Regards, Amarendra > > > > > > > > > > > > > > > -- > Adrian Klaver > adrian.klaver@aklaver.com > -- Adrian Klaver adrian.klaver@aklaver.com