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 1lwoZv-00013M-VD for pgsql-performance@arkaria.postgresql.org; Fri, 25 Jun 2021 16:21:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lwoZt-0006aM-Rq for pgsql-performance@arkaria.postgresql.org; Fri, 25 Jun 2021 16:21:13 +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 1lwoZt-0006aD-GA for pgsql-performance@lists.postgresql.org; Fri, 25 Jun 2021 16:21:13 +0000 Received: from mail-il1-x129.google.com ([2607:f8b0:4864:20::129]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lwoZp-0005TW-Rt for pgsql-performance@lists.postgresql.org; Fri, 25 Jun 2021 16:21:12 +0000 Received: by mail-il1-x129.google.com with SMTP id q9so10190067ilj.3 for ; Fri, 25 Jun 2021 09:21:08 -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=MdP2N+yzsLNsZD3ABhVn6QeXvJJbUrUg2b5yUdszM8c=; b=R4ca6o2tQphbB+Hw82Qmdu6D8TMTONzBxv2eSQRMvGrWby+oo2lFQvuPftL06wNO6F qKzkc2jN2kMXa64ByNB5g2Ks1fecH/Pw1seSfxajX/N4wW1eyRCaLV+IgjYujI7x5TxT zHkEBisSM5AJmWtVgownUGFffLPShPTsQDQVZG6ChGVxu8xkqocYEjME3oVV0fJx/P1B g1jwy6CuqwxpuiB9oCju+8DVJSBvi7TJo246dxbjrfwRZw9dWz3s+he5O4wQpUyJowMk 63gks5vKICSHOm1Dc9+unzsKv6srnfxPGhxioLOoyJmPYu+pZtUDyL3ECWaJfxF7u3GI nmgA== 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=MdP2N+yzsLNsZD3ABhVn6QeXvJJbUrUg2b5yUdszM8c=; b=GwW82e7r94ApJ455I2YhUjK+0UtoNKFxJKT6wZv098zYXpNv2azxmemxWAFt7Mp7Ss Xnx/3lnusX0wPgmRnlfKZtzNyiLEKEbTLJf02bvNRgJYeZS+DOnd35s5vulmWkErZj0s wyxS6gzu9p1GwoMyEkcMqlhLw0m9wKVzPN8bcf3PYfoLD263N0USlfaf8MTr9XfuitBC NKvx9fS6LcQBr+fRUewM7NLtK0c+ppmWTSUwAqWQpHmi6Yj2EvEosYjOif6CETc4iRM9 O+wtw89YUCtJ7U3AAuLWDTIHFKHPCpf8q4+bM80QOhukY3xYEkxEAzxyGp1AVPVobQBB 8Dzw== X-Gm-Message-State: AOAM530v5r9po9fbJwFv++w1rlploLdOwbAMTMV3NiwE8aNwV5efzLGH 32Y0zEqE4gf8/zZtM1X7d8r3lA== X-Google-Smtp-Source: ABdhPJxoNMBylTEXqQukrzKmsgE4H9rJOIQaxSfuUBCp9wJau3GcrFba+YG0u0PqHLP1gmAemh1FvA== X-Received: by 2002:a92:dc48:: with SMTP id x8mr8297721ilq.213.1624638067769; Fri, 25 Jun 2021 09:21:07 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id q19sm3661363ilc.70.2021.06.25.09.21.07 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Jun 2021 09:21:07 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 53EE2801593; Fri, 25 Jun 2021 11:21:06 -0500 (CDT) Date: Fri, 25 Jun 2021 11:21:06 -0500 From: Justin Pryzby To: Ayub Khan Cc: pgsql-performance@lists.postgresql.org Subject: Re: slow performance with cursor Message-ID: <20210625162106.GM29179@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, Jun 25, 2021 at 07:09:31PM +0300, 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 the query slower, or is it slow to transfer tuples ? I expect there would be a very high overhead if you read a large number of tuples one at a time. > 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. Is the slowness between the client-server or on the server side ? Provide some details ? -- Justin