Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1x3skA-006jPh-2d for pgsql-hackers@arkaria.postgresql.org; Tue, 08 Sep 2026 10:07:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1x3sk9-006FLs-1l for pgsql-hackers@arkaria.postgresql.org; Tue, 08 Sep 2026 10:07:57 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1x3sk9-006FLj-0n for pgsql-hackers@lists.postgresql.org; Tue, 08 Sep 2026 10:07:57 +0000 Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1x3sk7-00000003YeW-09dp for pgsql-hackers@lists.postgresql.org; Tue, 08 Sep 2026 10:07:56 +0000 Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-5b28c91fba5so4860856e87.1 for ; Tue, 08 Sep 2026 03:07:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788862073; x=1789466873; darn=lists.postgresql.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=PHcmJWAAWJf/ikv1IrEI51eEkTqWdk2/4Jr2dm3CEEA=; b=JwfKkqpaaMGgiJHzE4RCvK9RglKPgk9DBi6jiWwOJoROt/U637awyvmnjir3IfNpTC 5s2GOheGSTydOy0nTdnXSUm8iMdUrxxlIuWFYVg8/Qjpsrpe1c5Ch/DxZ9SG26NRiRCF x/29FZ9BflOAmoKM22pL8AHs8J5Dfjh1544mdFYHYigD2UBQszMOzKKQxjS50dd06WWm vWNv9egOGqZSJCkXHir/Qn9UTni7uSvNUvqaE0gsvIG8nzbuvfwIzG/0tlcOICXVrej0 zm1MkXA5veoao2v1xyxqq5IID/yzeBwjDCGSRG5D7y/kH0UT/mzZUlFtuDrYGAcdEKk7 oCaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788862073; x=1789466873; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=PHcmJWAAWJf/ikv1IrEI51eEkTqWdk2/4Jr2dm3CEEA=; b=CD4tcKV0COl20Tv2VzTvAcCdEXphtrso1g/KJ3EcY+r5geD+XQsYDHTx26/C+5Ixtt e64WWvgNRuGpiHryqD+dsPfdzhB8rts3bn53OpsT7XzJ/ht3s4vederI/Ry/p6Vok1OS vPOpgT0dmCYwPdQHyntDs2aCbaJtW7lNBrFrNn9+JYXf09h5m/IFV50UteXYgGC+tCUD WJZBKLPN0+XitqC3y8MzXZAvfsQN2vMe2I/hV28kIL7R0toPts1+hZrOvHxKXB1I45Zm ydPHAz5WZOq+R9JUNVp/4VogA03BZ4dYcI4DCth2iUsAUZZMVvasSp4brBvgII08qDCV 0Lsw== X-Gm-Message-State: AFuF++kLBjODDGLEfSy8P9wZdqtGTC7fktfgcXekZlk6J5kwa3UHU1lo Aly2Yl7Kj8qSqWuQoPb8qM196lZUf3qwDBgEv+boSBD6MwobFfJqtOTO X-Gm-Gg: AYBFou0iqAfb32ep611SU1CN6lS24PzUio4abIBiz9IQ7EkWKDU2OaLbCxz5b53zlck MAo5rRPIf43AKiukZpSI2Anlxg/Grv1mk9PxGyN8v6IVNPSeV1T0BnKNgirB6CsUVvlktMe1jrN 0pZa/bJMxfQ4yo9ixnPXna14im1XoBW8TWLNKSKd71UEi9L1A2XuU85WcuHN1ny2FXGaBugv3wW tQlKCYqLXfEjJdVa5ZxWHBzKYDtBXWq8Hi5nwKicYJpWLjS7vf9HoyltjBZWcaSLYzk67dm+AnN rOoygUsJ5++0pywsF9unCe/humWzGVY2i7n4X4h3fkkUCnmrSOrI4Xf/I0PhY9oksXtUKpa/Q3Z JK1o7iFgR9mW/VZts4mqKsp6HE1DYXcGd4exu7Fymc5oXe+PycncmMq/65aI6ejmx2W8x3L2FwF c/6JHBC41fyxRyObOaxpmCnQ6IU5jzLQM6/tZ1zV5ZtFE+35ojDJQ6eNkBr3v8XMYBSjzzsKz/S g== X-Received: by 2002:a05:6512:124e:b0:5b6:1783:ceef with SMTP id 2adb3069b0e04-5b61783cf56mr4020397e87.44.1788862072598; Tue, 08 Sep 2026 03:07:52 -0700 (PDT) Received: from [192.168.15.240] ([80.251.191.198]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5b6167027dcsm2929747e87.58.2026.09.08.03.07.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 08 Sep 2026 03:07:49 -0700 (PDT) Message-ID: Date: Tue, 8 Sep 2026 12:07:48 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] Planner support function for generate_subscripts() To: shihao zhong , Priyanka S Cc: pgsql-hackers References: Content-Language: en-US From: Andrei Lepikhov In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 08/09/2026 03:21, shihao zhong wrote: > * A dimension above the first is asked for on an array that is not a >   constant.  One dimension of an array is never longer than the whole >   array, so a large number is wrong here. > > 1000 fits neither case. > > I kept 0002 as its own patch.  It only changes a number in the catalog, > and 0001 does not need it.  If people do not agree on the number, 0001 > can still go in. I'd say that detecting the estimate_array_length's default value for the rows number and returning constant 1000 as used before might make life of engineers easier and query plans more stable during upgrade. Hence, maybe it makes sense to follow the way of group-by estimations - introduce something like one more 'isdefault' parameter to the estimate_array_length? Basically, this code looks good. But I'd like to see more assertions: if something will be changed at the functions itself it would more quickly detect issues in the prosupport routine. For example: - Assert(req->root != NULL); - Type of arg2 - Potentially, no more than 3 arguments of the function - Maybe hard oid check on F_GENERATE_SUBSCRIPTS / F_GENERATE_SUBSCRIPTS_NODIR This topic also raises the question of the practical usability of the average total number of elements in an array column. Your tests highlight a gap in estimates for more than two dimensions. regards, Andrei Lepikhov, pgEdge