ERROR: cache lookup failed for relation ERROR: cache lookup failed for namespace
Cache lookup failures are usually related to index problems. The first step is always to rebuild the index to rule out index corruption.
Example pg_class error:
# drop table my_table; ERROR: cache lookup failed for relation 1012608 (utility.c:212) (seg2 sdw1:40002 pid=10204) (cdbdisp.c:1528)
To resolve this error, reindex pg_class:
# REINDEX TABLE pg_class ; REINDEX
Example pg_depend error:
# DROP ROLE my_role; ERROR: cache lookup failed for namespace 2719529 (dependency.c:2271)
To resolve this error, reindex pg_depend:
# reindex table pg_depend ; REINDEX
If you are not sure what catalog table you should reindex, you can reindex all system tables using this command:
gpadmin=# reindex system <db name>; NOTICE: table "gp_configuration_history" has no indexes NOTICE: table "gp_id" has no indexes NOTICE: table "gp_version_at_initdb" has no indexes REINDEX
Note: Reindexing catalog takes locks and it might be worth to perform it during maintenance in restricted mode if you have a buys cluster with many queries.
If the problem still exist after performing a system reindex, it might be a data corruption in system catalog. Continue with gpcheckcat to check the catalog integrity. For more information about gpcheckcat, refer to: How to run gpcheckcat on a Tanzu Greenplum Database