May 2019
Intermediate to advanced
600 pages
20h 46m
English
Here, we will describe a procedure that allows us to deactivate an index without actually dropping it so that we can appreciate what its contribution was and possibly reactivate it:
CREATE OR REPLACE FUNCTION trial_drop_index(iname TEXT) RETURNS VOIDLANGUAGE SQL AS $$ UPDATE pg_indexSET indisvalid = falseWHERE indexrelid = $1::regclass;$$;
CREATE OR REPLACE FUNCTION trial_undrop_index(iname TEXT) RETURNS VOIDLANGUAGE SQL AS $$ UPDATE pg_indexSET indisvalid = trueWHERE indexrelid = $1::regclass;$$;
Read now
Unlock full access