Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jnyiW-0001AO-Pg for pgsql-admin@arkaria.postgresql.org; Wed, 24 Jun 2020 06:17:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jnyiV-0000Hw-Ns for pgsql-admin@arkaria.postgresql.org; Wed, 24 Jun 2020 06:17:03 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jnygC-00056y-HB for pgsql-admin@lists.postgresql.org; Wed, 24 Jun 2020 06:14:40 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jnyg9-0003zY-DI for pgsql-admin@postgresql.org; Wed, 24 Jun 2020 06:14:39 +0000 Received: by mail-wr1-x441.google.com with SMTP id z13so1021208wrw.5 for ; Tue, 23 Jun 2020 23:14:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:date:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=hTrU179AbVS6X2FPWkHziJf1sJTo+5bsxx1is8cJA8g=; b=Wgctc+Go/jmgAMG9nU5nx5lX663hrWjYVkAVMfFBrXkQiCpEeMmCB9yz/bn6hYEmwD MKZhXMPloNsohHxOjnH+y6/NNBA1Kp4LJMn4JgpT7Iktynd82ZrGFgXii3ufCTdhp6GC n6qlIE9W1mgF2GkG0TJaLLRUzVveifBA2jpB9pd8TcjWvrOSE7Ld7Z4BGy/0hpNQTQCn NyXAFz3oc5b2aPL7/neMSlCWwXexM2bLUVo5VAh3cv9jE0UICpt8Olk4y64Y/CQeiK2O sfOqky+5LYosfxOE/smqh92Go6PMcY732vN5TtnkBmHIRU55R8fUPNL4VvKvRxXLtAnY +vog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=hTrU179AbVS6X2FPWkHziJf1sJTo+5bsxx1is8cJA8g=; b=Mll5K+h0O/PD/CJobjd6F+6p7JnlalAe86AfXE62vu/iLY7L6Q8jAJO9oI/lGkavXr 6ntfUdTCjTUOYmDeGHU3zKgvAR1tNyIHKVmT0xS2Gl8RnBhYOdfGwQWw2k5hHW17NTuY 6mFwP+1NXzco0SbZgoD3zaoM3ZZt0mXB9J+tDUEXmRUng60GBgWhb2k0RNyRl/55FP1a 0Uqjj6IxfCubILouJKN18sAt0MFxxoIqN+LVd4TuahhSpaYzS4iax/NNENTflpuS4Yvg /A9fvDBiXCkVw+3CxUSlwr6K4TYEz1QSdV1Uox5XVW6f1qamkha7vfVxuHWi4u+KtEXR hMAA== X-Gm-Message-State: AOAM533UwdainqkQ8pnWFj5HdA8upeUy+KBW/+U1Nm8JsVz0Eqbylswc WyAv59liVM8SXOo5AJKsSOZoKA== X-Google-Smtp-Source: ABdhPJz8DgspC8RI8ryYLmZ5S9sKBG8OSDpmrpzTLzPnxfz/OmLm+EvcQ5/DkoNM87+cwylhGGQsJA== X-Received: by 2002:a5d:4986:: with SMTP id r6mr24348733wrq.424.1592979273230; Tue, 23 Jun 2020 23:14:33 -0700 (PDT) Received: from localhost.localdomain (217-149-173-211.nat.highway.telekom.at. [217.149.173.211]) by smtp.gmail.com with ESMTPSA id v4sm10661361wro.26.2020.06.23.23.14.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jun 2020 23:14:32 -0700 (PDT) Message-ID: <9dda6f8fa24bb80c7456a8439cba0b4adf2b8ae4.camel@cybertec.at> Subject: Re: Performance of SELECT directly and from application From: Laurenz Albe To: Jessica Holle , Pgsql-admin Date: Wed, 24 Jun 2020 08:14:31 +0200 In-Reply-To: <404eece7-44b3-bbb4-177a-ff955d10e7e6@vit.de> References: <404eece7-44b3-bbb4-177a-ff955d10e7e6@vit.de> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.32.5 (3.32.5-1.fc30) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Wed, 2020-06-24 at 07:00 +0200, Jessica Holle wrote: > we use PostgreSQL 12.3.1 and have a little bit trouble with performance. > When the statement comes from the application (wildfly) duration is > about 24982.819 ms. When I do the statement directly with psql duration > is 967.773 ms. > Duration from Wildfly is known becaue we use in postgresql.conf > "log_min_duration_statement = 5000". There I see, that from application > are 3 variables used. > Is there any idea why this can happen or a hint to solve this issue? Try using "auto_explain" to get EXPLAIN (ANALYZE, BUFFERS) output for the slow execution. The comparison of these two execution plans would be instructive. Does the application set any parameters? Does it use a cursor? Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com