From: | jian he <jian(dot)universality(at)gmail(dot)com> |
---|---|
To: | Shayon Mukherjee <shayonj(at)gmail(dot)com> |
Cc: | Benoit Lobréau <benoit(dot)lobreau(at)gmail(dot)com>, Sami Imseih <samimseih(at)gmail(dot)com>, Michail Nikolaev <michail(dot)nikolaev(at)gmail(dot)com>, David Rowley <dgrowleyml(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Peter Eisentraut <peter(at)eisentraut(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Proposal to Enable/Disable Index using ALTER INDEX (with patch) |
Date: | 2025-02-02 09:41:15 |
Message-ID: | CACJufxH3G=Ddm2qTnOM8iq=RB_unc4pOm9o34j=A1=s1LwmDwA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
hi.
the following reviews based on
v10-0001-Introduce-the-ability-to-set-index-visibility-us.patch.
in src/test/regress/sql/create_index.sql
seems there are no sql tests for "create index ... invisible"?
<varlistentry>
<term><literal>VISIBLE</literal></term>
<listitem>
<para>
Make the specified index visible. The index will be used for queries.
</para>
</listitem>
</varlistentry>
here it should be
"Make the specified index visible. The index can be used for query planning"
?
Do we need to add GUC use_invisible_index to postgresql.conf.sample?
CREATE TABLE t(id INT PRIMARY KEY, data TEXT,num INT, vector INT[],
range INT4RANGE);
ALTER INDEX t_pkey INVISIBLE;
alter table t alter column id set data type bigint;
\d t
after ALTER TABLE SET DATA TYPE, the "visible" status should not change?
but here it changed.
you may check ATPostAlterTypeParse to make the "visible" status not change.
@@ -3449,6 +3451,7 @@ typedef struct IndexStmt
bool if_not_exists; /* just do nothing if index already
exists? */
bool reset_default_tblspc; /* reset default_tablespace prior to
* executing */
+ bool isvisible; /* true if VISIBLE (default), false
if INVISIBLE */
} IndexStmt;
the indentation level is not right?
+opt_index_visibility:
+ VISIBLE_P { $$ = true; }
+ | INVISIBLE_P { $$ = false; }
+ | /*EMPTY*/ { $$ = true; }
+ ;
+
the indentation level seems also not right?
+ createFlags = INDEX_CREATE_SKIP_BUILD | INDEX_CREATE_CONCURRENT;
+ if (indexForm->indisvisible)
+ createFlags |= INDEX_CREATE_VISIBLE;
the indentation level seems also not right?
INVISIBLE, VISIBLE is not special words, in gram.y, you don't need
"VISIBLE_P", "INVISIBLE_P", you can just use "INVISIBLE", "VISIBLE"
?
\d t3
Table "public.t3"
Column | Type | Collation | Nullable | Default
--------+-----------+-----------+----------+---------
id | integer | | not null |
data | text | | |
num | integer | | |
vector | integer[] | | |
range | int4range | | |
a | box | | |
Indexes:
"t3_pkey" PRIMARY KEY, btree (id) INVISIBLE
"grect2ind" gist (a) INVISIBLE
"t3_1" gist (a) INVISIBLE
"t3_2" gin (vector) WITH (fastupdate='on',
gin_pending_list_limit='128') INVISIBLE
"t3_4" spgist (data) INVISIBLE
"t3_6" hash (id) INVISIBLE
pg_dump will dump as
--
-- Name: t3 t3_pkey; Type: CONSTRAINT; Schema: public; Owner: jian
--
ALTER TABLE ONLY public.t3
ADD CONSTRAINT t3_pkey PRIMARY KEY (id);
after dump, restore index (primary key: t3_pkey) INVISIBLE will not be restored.
We need extra work for restoring the INVISIBLE flag for the primary key index.
I am not sure if we need to change index_concurrently_swap or not.
but many other pg_index columns changed.
From | Date | Subject | |
---|---|---|---|
Next Message | Andrey Borodin | 2025-02-02 10:15:26 | Re: UUID v7 |
Previous Message | Tom Lane | 2025-02-02 05:15:25 | Re: Add a function to get the version of installed extension |