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 1lyzcF-0006B0-88 for pgsql-performance@arkaria.postgresql.org; Thu, 01 Jul 2021 16:32:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lyzcE-0002Y5-5b for pgsql-performance@arkaria.postgresql.org; Thu, 01 Jul 2021 16:32:38 +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 1lyzcD-0002Xx-QU for pgsql-performance@lists.postgresql.org; Thu, 01 Jul 2021 16:32:37 +0000 Received: from mail-io1-xd35.google.com ([2607:f8b0:4864:20::d35]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lyzcB-0004vp-7H for pgsql-performance@lists.postgresql.org; Thu, 01 Jul 2021 16:32:36 +0000 Received: by mail-io1-xd35.google.com with SMTP id v3so8225062ioq.9 for ; Thu, 01 Jul 2021 09:32:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=81frDRUtW0AbWbX1wPHVVyqq8t6hb2m8u18kuaNagz0=; b=tPLqt32KFiM2TKXU6iwg73d3JJ7K/9KjbdcWGeDQ0qYrBrCp96riJUEyvozOfwc3sP vsfYrK8oFBaU0X5T8/95ZD3mQZNlICSiPV1LLAIWnEs84Rg1+WLo7V1efkpO4/xETctu LuJh0It6OB9OVetv7O57ny5+/AM0zbw5zTbM70gZVKXb+RJZbUmiQyJfzlRSoDZBh4UY 2o263+KYHbhGvOR4XECnvc3ZG2sdoYvafp7Zrr+XkckAUnAIps/J9BzU33n+WfbQB7yp q29vWxEoakZJgoPWJKFbhdNyG3c2Kx4eI2qnhraourvOawZbAvhnd/Te8L6T+LHGnzPl TJgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=81frDRUtW0AbWbX1wPHVVyqq8t6hb2m8u18kuaNagz0=; b=O3ezOpJeJud7yHpKXJ+WSLswjGJl35HNRmBDriFg3mHNSqGGwN9gmWEToGp4oEusM6 dtP9QQiDYM8gw1f9SaouvqQ0jmeOYIaYdP/P2SzO9r0Wre2OP1ZOKtqsrAaTp8RY0DVF j0KDnJtINUrOlP1A4JPuh0CSu0Dpn7RfG/ujX5CQxyysxHCK6ARy2qeVSwAlXi60z0uG iT9s8Sw6FReb8jT3egt8xSuDY2+7xDQFT1+pFHvMi5NF0ClU9TCLEK+eX90pFOcOANd+ gvKp/c+Ys6Rf7F6Hu3LGRg77mCcbE4jWBcX1cVsQqmpXfUgi+hiCIfylQdRgt+W3y0Pa nSRg== X-Gm-Message-State: AOAM533gupvTMwQQ4xXAa7Y/5NKM0UduqpELRiekVDkl8Iow+Qqxmpgl //n2uo6R/yGTvp+Ti4VBheTVAg== X-Google-Smtp-Source: ABdhPJxa17JHP98C057VDpmFAGmAHH4jFSV1Jn2qq9Yvw/mfCNgfkNlwp2DUMpQHxEPqL1N1jx8S2g== X-Received: by 2002:a05:6638:380b:: with SMTP id i11mr633195jav.57.1625157153728; Thu, 01 Jul 2021 09:32:33 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id y2sm203993ilh.82.2021.07.01.09.32.32 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Jul 2021 09:32:33 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 75173800989; Thu, 1 Jul 2021 11:32:31 -0500 (CDT) Date: Thu, 1 Jul 2021 11:32:31 -0500 From: Justin Pryzby To: Ayub Khan Cc: pgsql-performance@lists.postgresql.org Subject: Re: slow performance with cursor Message-ID: <20210701163231.GR21248@telsasoft.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 25 Jun 2021, 19:09 Ayub Khan, wrote: > I am using postgresql 12 and using cursors in a stored procedure, > executing procedure which has cursor is slowing down the call. However if I > do not use the cursor and just execute the queries using JDBC (Java client) > it's fast. > > Is there any setting which needs to be modified to improve the performance > of cursors. Also facing slow response with reading blobs (images) from db. > Not an ideal way for storing images in db but this is a legacy application > and wanted to check if there a quick tweak which can improve the > performance while reading blob data from db. On Thu, Jul 01, 2021 at 07:29:31PM +0300, Ayub Khan wrote: > I set the cursor_tuple_fraction to 1 now I am seeing high cpu for fetach > all in > > The number of rows returned is less than 200. Why is the high cpu being > shown for fetch all It seems like you're asking for help, but need to show the stored procedure you're asking for help with.