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 1oeg3a-00030B-JK for pgsql-general@arkaria.postgresql.org; Sat, 01 Oct 2022 17:13:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oeg3Y-0001na-Ds for pgsql-general@arkaria.postgresql.org; Sat, 01 Oct 2022 17:13:40 +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 1oeg3Y-0001nP-0q for pgsql-general@lists.postgresql.org; Sat, 01 Oct 2022 17:13:40 +0000 Received: from mail-oo1-xc33.google.com ([2607:f8b0:4864:20::c33]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oeg3V-0000uC-6b for pgsql-general@lists.postgresql.org; Sat, 01 Oct 2022 17:13:38 +0000 Received: by mail-oo1-xc33.google.com with SMTP id t4-20020a4aa3c4000000b00475624f2369so4280109ool.3 for ; Sat, 01 Oct 2022 10:13:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date; bh=qmpa4VZMKoKtRNynslhf1iDU6RJRwVCoVN764Kntlsk=; b=U80VZrqUURL5emvIqu0olSgfvLV18Hzd4hOd7rTP1GnXnBeJlFaPwMsnB4fw8TjVoP bWjncQwZLY5rbdroZHM87F+n80Wp6D7ZdZDC0lfJCDyoyX6z7mZse0xPw7r+hYBNBck3 aZYdeP7ggcVSsrL0YrEMI/+qh8EoMex0SvPuEz00XPAqg9gorLt3NlKTkIy+4S0OOeiL sbQfn0u2s0Z1EdbH7bLhoGkgkxk6UzdcEKkJJadMr3Cow/xR6U3uw15x9Ow6GwdnP7xH iwCb5h8dIWHgJHbcgSN7YIet5L5BYQjZ0enpTvy4ogXpB9tisQkEReiUhHgJ2YdfErbc 1vbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date; bh=qmpa4VZMKoKtRNynslhf1iDU6RJRwVCoVN764Kntlsk=; b=4PQoslC0fZUXptdSXVzxWe54BS5rrFLjGnWi/PMePhpMK62hg4Jwq6axhhc/Z6K9M8 ZRzln+GSSo94IWMuBCQZQIO6WMp585SS5yebltjKkwWetT9wmzsOc8nLiti5XQ6DBLug Ofdqaix8r8eJM2841kJSjCf932nTfQ8uKlPLEkdZBhY74C9dPG7l2WAUaAVrPXEHaZjF Cxu1opnq0EAHoQRtpILJWlVM/w3FaCvYu4WkSnzYjtzliyOlgk5Fr7bhK0lmvpARm2Sl 7F0GXSrjbSQ6jUHxzVGHaGQ8jIv8qbkexxWPdsdu5tF6ggFrrBYtUtsDl5FaibRvr+Mg QBjQ== X-Gm-Message-State: ACrzQf3MAHdlRvIY2KAixFAJQDDKUCfGjN5pu2sd7bzKP9xZgJO+HbjB SjHRWOfvbIaBtumc2+H8tLr8aNFwTHo= X-Google-Smtp-Source: AMsMyM6oLek1q7+X7ZS90ayJb4ZJzN+/G1o0VPmoahrRROwZUsNVutzDR3XefZ8RaKhJNWHHcGZY2Q== X-Received: by 2002:a9d:4047:0:b0:659:738a:95a3 with SMTP id o7-20020a9d4047000000b00659738a95a3mr5553313oti.134.1664644416123; Sat, 01 Oct 2022 10:13:36 -0700 (PDT) Received: from [192.168.88.10] (ip68-11-68-85.no.no.cox.net. [68.11.68.85]) by smtp.googlemail.com with ESMTPSA id q135-20020a4a338d000000b0044897475dd0sm1110288ooq.43.2022.10.01.10.13.35 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 01 Oct 2022 10:13:35 -0700 (PDT) Message-ID: Date: Sat, 1 Oct 2022 12:13:34 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: Example code Re: Singleton SELECT inside cursor loop Content-Language: en-US To: pgsql-general@lists.postgresql.org References: <20221001122000.jq7f5wnmzbewimpn@hjp.at> From: Ron In-Reply-To: <20221001122000.jq7f5wnmzbewimpn@hjp.at> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 10/1/22 07:20, Peter J. Holzer wrote: > On 2022-10-01 02:22:22 -0500, Ron wrote: >> I extracted the singleton into a function, and that helped me isolate the >> problem. > I don't know what a singleton select is (duckduckgo tells me it has > something to do with DB2 and/or COBOL, or maybe it's a whisky), but: A query which returns one row.  Typically SELECT COUNT/MAX/etc without a GROUP BY clause. -- Angular momentum makes the world go 'round.