From: Andrey Lepikhov <a.lepikhov@postgrespro.ru>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Increase value of OUTER_VAR
Date: Wed, 3 Mar 2021 11:29:12 +0300
Message-ID: <43c7f2f5-1e27-27aa-8c65-c91859d15190@postgrespro.ru> (raw)
Hi,
Playing with a large value of partitions I caught the limit with 65000
table entries in a query plan:
if (IS_SPECIAL_VARNO(list_length(glob->finalrtable)))
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
errmsg("too many range table entries")));
Postgres works well with so many partitions.
The constants INNER_VAR, OUTER_VAR, INDEX_VAR are used as values of the
variable 'var->varno' of integer type. As I see, they were introduced
with commit 1054097464 authored by Marc G. Fournier, in 1996.
Value 65000 was relevant to the size of the int type at that time.
Maybe we will change these values to INT_MAX? (See the patch in attachment).
--
regards,
Andrey Lepikhov
Postgres Professional
Attachments:0001-Set-values-of-special-varnos-to-the-upper-bound-of-t.patch (text/plain, 1.1K) download
From 98da77cdefd53dbf4ce0c740d1a0f356da970648 Mon Sep 17 00:00:00 2001
From: "Andrey V. Lepikhov" <a.lepikhov@postgrespro.ru>
Date: Wed, 3 Mar 2021 11:22:32 +0300
Subject: [PATCH] Set values of special varnos to the upper bound of the int
type
---
src/include/nodes/primnodes.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.hindex d4ce037088..9038d97886 100644--- a/src/include/nodes/primnodes.h+++ b/src/include/nodes/primnodes.h@@ -168,9 +168,9 @@ typedef struct Expr
* in the planner and doesn't correspond to any simple relation column may
* have varnosyn = varattnosyn = 0.
*/
-#define INNER_VAR 65000 /* reference to inner subplan */-#define OUTER_VAR 65001 /* reference to outer subplan */-#define INDEX_VAR 65002 /* reference to index column */+#define INNER_VAR (INT_MAX - 2) /* reference to inner subplan */+#define OUTER_VAR (INT_MAX - 1) /* reference to outer subplan */+#define INDEX_VAR (INT_MAX) /* reference to index column */
#define IS_SPECIAL_VARNO(varno) ((varno) >= INNER_VAR)
--
2.29.2
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: a.lepikhov@postgrespro.ru, pgsql-hackers@lists.postgresql.org
Subject: Re: Increase value of OUTER_VAR
In-Reply-To: <43c7f2f5-1e27-27aa-8c65-c91859d15190@postgrespro.ru>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox