Global SysCache

Offering: openGaussDev

More detail:
lsc内存控制

# Conflicts:
#	src/test/regress/expected/gsc_func.out

Match-id-675c5cad1d601f1e7ca9e318fe82367c9626f4e8
This commit is contained in:
openGaussDev
2022-03-04 11:00:45 +08:00
committed by yanghao
parent f45ec47b1b
commit 66b05d1215
5 changed files with 109 additions and 78 deletions

View File

@ -593,7 +593,6 @@ void LocalSysDBCache::LocalSysDBCacheClearMyDB(Oid db_id, const char *db_name)
MemoryContextResetAndDeleteChildren(lsc_mydb_memcxt); MemoryContextResetAndDeleteChildren(lsc_mydb_memcxt);
is_inited = false; is_inited = false;
other_space = ((AllocSet)lsc_top_memcxt)->totalSpace + ((AllocSet)lsc_share_memcxt)->totalSpace;
rel_index_rule_space = 0; rel_index_rule_space = 0;
} }
@ -622,29 +621,26 @@ void LocalSysDBCache::LocalSysDBCacheReSet()
UnRegisterRelCacheCallBack(&inval_cxt, RelfilenodeMapInvalidateCallback); UnRegisterRelCacheCallBack(&inval_cxt, RelfilenodeMapInvalidateCallback);
UnRegisterSysCacheCallBack(&inval_cxt, TABLESPACEOID, InvalidateTableSpaceCacheCallback); UnRegisterSysCacheCallBack(&inval_cxt, TABLESPACEOID, InvalidateTableSpaceCacheCallback);
MemoryContextResetAndDeleteChildren(lsc_mydb_memcxt); MemoryContextDelete(lsc_mydb_memcxt);
MemoryContextResetAndDeleteChildren(lsc_share_memcxt); MemoryContextDelete(lsc_share_memcxt);
lsc_share_memcxt =
AllocSetContextCreate(lsc_top_memcxt, "LocalSysCacheShareMemoryContext", ALLOCSET_DEFAULT_MINSIZE,
ALLOCSET_DEFAULT_INITSIZE, ALLOCSET_DEFAULT_MAXSIZE, STANDARD_CONTEXT);
lsc_mydb_memcxt =
AllocSetContextCreate(lsc_top_memcxt, "LocalSysCacheMyDBMemoryContext", ALLOCSET_DEFAULT_MINSIZE,
ALLOCSET_DEFAULT_INITSIZE, ALLOCSET_DEFAULT_MAXSIZE, STANDARD_CONTEXT);
MemoryContext old = MemoryContextSwitchTo(lsc_share_memcxt); MemoryContext old = MemoryContextSwitchTo(lsc_share_memcxt);
knl_u_relmap_init(&relmap_cxt); knl_u_relmap_init(&relmap_cxt);
MemoryContextSwitchTo(old); MemoryContextSwitchTo(old);
other_space = ((AllocSet)lsc_top_memcxt)->totalSpace + ((AllocSet)lsc_share_memcxt)->totalSpace;
rel_index_rule_space = 0; rel_index_rule_space = 0;
is_inited = false; is_inited = false;
is_closed = false; is_closed = false;
is_lsc_catbucket_created = false; is_lsc_catbucket_created = false;
} }
static bool LSCMemroyOverflow(uint64 total_space)
{
const uint32 kb_bit_double = 10;
if (unlikely(total_space < ((uint64)g_instance.attr.attr_memory.local_syscache_threshold << kb_bit_double))) {
return false;
}
return true;
}
bool LocalSysDBCache::LocalSysDBCacheNeedReBuild() bool LocalSysDBCache::LocalSysDBCacheNeedReBuild()
{ {
/* we have recovered from startup, redo may dont tell us inval msgs, so discard all lsc */ /* we have recovered from startup, redo may dont tell us inval msgs, so discard all lsc */
@ -655,15 +651,21 @@ bool LocalSysDBCache::LocalSysDBCacheNeedReBuild()
return true; return true;
} }
/* it seems only fmgr_info_cxt has no resowner to avoid mem leak. /* we assum 1kb memory leaked once */
* we assum 1kb memory leaked once */
if (unlikely(abort_count > (uint64)g_instance.attr.attr_memory.local_syscache_threshold)) { if (unlikely(abort_count > (uint64)g_instance.attr.attr_memory.local_syscache_threshold)) {
return true; return true;
} }
uint64 total_space = other_space + AllocSetContextUsedSpace((AllocSet)lsc_mydb_memcxt) + uint64 total_space =
AllocSetContextUsedSpace((AllocSet)u_sess->cache_mem_cxt) + rel_index_rule_space; ((AllocSet)lsc_top_memcxt)->totalSpace +
return LSCMemroyOverflow(total_space); ((AllocSet)lsc_share_memcxt)->totalSpace +
((AllocSet)lsc_mydb_memcxt)->totalSpace +
((AllocSet)u_sess->cache_mem_cxt)->totalSpace +
rel_index_rule_space;
uint64 memory_upper_limit = ((uint64)g_instance.attr.attr_memory.local_syscache_threshold) << 10;
return total_space * (1 - MAX_LSC_FREESIZE_RATIO) > memory_upper_limit;
} }
/* rebuild cache on memcxt of mydb or share, call it only before initsyscache */ /* rebuild cache on memcxt of mydb or share, call it only before initsyscache */
@ -693,8 +695,23 @@ void LocalSysDBCache::LocalSysDBCacheReBuild()
bool LocalSysDBCache::LocalSysDBCacheNeedSwapOut() bool LocalSysDBCache::LocalSysDBCacheNeedSwapOut()
{ {
uint64 total_space = other_space + rel_index_rule_space + ((AllocSet)lsc_mydb_memcxt)->totalSpace; uint64 used_space =
return LSCMemroyOverflow(total_space); AllocSetContextUsedSpace((AllocSet)lsc_top_memcxt) +
AllocSetContextUsedSpace((AllocSet)lsc_share_memcxt) +
AllocSetContextUsedSpace((AllocSet)lsc_mydb_memcxt) +
AllocSetContextUsedSpace((AllocSet)u_sess->cache_mem_cxt) +
rel_index_rule_space;
uint64 memory_upper_limit =
(((uint64)g_instance.attr.attr_memory.local_syscache_threshold) << 10) * cur_swapout_ratio;
bool need_swapout = used_space > memory_upper_limit;
/* swapout until memory used space is from MAX_LSC_SWAPOUT_RATIO=90% to MIN_LSC_SWAPOUT_RATIO=70% */
if (unlikely(need_swapout && cur_swapout_ratio == MAX_LSC_SWAPOUT_RATIO)) {
cur_swapout_ratio = MIN_LSC_SWAPOUT_RATIO;
} else if (unlikely(!need_swapout && cur_swapout_ratio == MIN_LSC_SWAPOUT_RATIO)) {
cur_swapout_ratio = MAX_LSC_SWAPOUT_RATIO;
}
return need_swapout;
} }
void LocalSysDBCache::CloseLocalSysDBCache() void LocalSysDBCache::CloseLocalSysDBCache()
@ -717,7 +734,6 @@ void LocalSysDBCache::ClearSysCacheIfNecessary(Oid db_id, const char *db_name)
if (unlikely(!is_inited)) { if (unlikely(!is_inited)) {
return; return;
} }
other_space = ((AllocSet)lsc_top_memcxt)->totalSpace + ((AllocSet)lsc_share_memcxt)->totalSpace;
/* rebuild if memory gt double of threshold */ /* rebuild if memory gt double of threshold */
if (unlikely(LocalSysDBCacheNeedReBuild())) { if (unlikely(LocalSysDBCacheNeedReBuild())) {
recovery_finished = g_instance.global_sysdbcache.recovery_finished; recovery_finished = g_instance.global_sysdbcache.recovery_finished;
@ -769,7 +785,6 @@ void LocalSysDBCache::CreateDBObject()
knl_u_relmap_init(&relmap_cxt); knl_u_relmap_init(&relmap_cxt);
MemoryContextSwitchTo(old); MemoryContextSwitchTo(old);
m_shared_global_db = g_instance.global_sysdbcache.GetSharedGSCEntry(); m_shared_global_db = g_instance.global_sysdbcache.GetSharedGSCEntry();
other_space = ((AllocSet)lsc_top_memcxt)->totalSpace + ((AllocSet)lsc_share_memcxt)->totalSpace;
rel_index_rule_space = 0; rel_index_rule_space = 0;
is_lsc_catbucket_created = false; is_lsc_catbucket_created = false;
} }
@ -782,9 +797,9 @@ void LocalSysDBCache::CreateCatBucket()
MemoryContext old = MemoryContextSwitchTo(lsc_share_memcxt); MemoryContext old = MemoryContextSwitchTo(lsc_share_memcxt);
systabcache.CreateCatBuckets(); systabcache.CreateCatBuckets();
MemoryContextSwitchTo(old); MemoryContextSwitchTo(old);
other_space = ((AllocSet)lsc_top_memcxt)->totalSpace + ((AllocSet)lsc_share_memcxt)->totalSpace;
rel_index_rule_space = 0; rel_index_rule_space = 0;
is_lsc_catbucket_created = true; is_lsc_catbucket_created = true;
cur_swapout_ratio = MAX_LSC_SWAPOUT_RATIO;
} }
void LocalSysDBCache::SetDatabaseName(const char *db_name) void LocalSysDBCache::SetDatabaseName(const char *db_name)
@ -953,6 +968,8 @@ LocalSysDBCache::LocalSysDBCache()
got_pool_reload = false; got_pool_reload = false;
m_shared_global_db = NULL; m_shared_global_db = NULL;
cur_swapout_ratio = MAX_LSC_SWAPOUT_RATIO;
is_lsc_catbucket_created = false; is_lsc_catbucket_created = false;
is_closed = false; is_closed = false;
is_inited = false; is_inited = false;

View File

@ -356,7 +356,7 @@ void LocalSysTupCache::InitPhase2Impl()
{ {
Assert(m_is_inited); Assert(m_is_inited);
Assert(!m_is_inited_phase2); Assert(!m_is_inited_phase2);
Assert(m_db_id == InvalidOid); /* CacheIdGetGlobalSysTupCache maybe fail when memory fault */
Assert(m_global_systupcache == NULL); Assert(m_global_systupcache == NULL);
/* for now we even dont know which db to connect */ /* for now we even dont know which db to connect */
if (m_relinfo.cc_relisshared) { if (m_relinfo.cc_relisshared) {
@ -509,7 +509,7 @@ LocalCatCTup *LocalSysTupCache::SearchTupleInternal(int nkeys, Datum v1, Datum v
/* if not found, search from global cache */ /* if not found, search from global cache */
if (unlikely(!found)) { if (unlikely(!found)) {
ct = SearchTupleFromGlobal(arguments, hash_value, hash_index, level); ct = SearchTupleFromGlobal(arguments, hash_value, hash_index, level);
if (ct == NULL) { if (unlikely(ct == NULL)) {
return NULL; return NULL;
} }
} }
@ -529,8 +529,10 @@ LocalCatCTup *LocalSysTupCache::SearchTupleInternal(int nkeys, Datum v1, Datum v
cc_neg_hits++; cc_neg_hits++;
ct = NULL; ct = NULL;
} }
if (unlikely(!found)) {
RemoveTailTupleElements(hash_index);
}
RemoveTailTupleElements(hash_index);
return ct; return ct;
} }
@ -665,15 +667,16 @@ LocalCatCList *LocalSysTupCache::SearchListInternal(int nkeys, Datum v1, Datum v
CACHE2_elog(DEBUG2, "SearchLocalCatCacheList(%s): found list", m_relinfo.cc_relname); CACHE2_elog(DEBUG2, "SearchLocalCatCacheList(%s): found list", m_relinfo.cc_relname);
cc_lhits++; cc_lhits++;
found = true; found = true;
ResourceOwnerRememberLocalCatCList(LOCAL_SYSDB_RESOWNER, cl);
break; break;
} }
if (unlikely(!found)) { if (unlikely(!found)) {
cl = SearchListFromGlobal(nkeys, arguments, hash_value, level); cl = SearchListFromGlobal(nkeys, arguments, hash_value, level);
ResourceOwnerRememberLocalCatCList(LOCAL_SYSDB_RESOWNER, cl);
RemoveTailListElements();
} }
ResourceOwnerRememberLocalCatCList(LOCAL_SYSDB_RESOWNER, cl);
RemoveTailListElements();
return cl; return cl;
} }
@ -817,12 +820,14 @@ LocalCatCTup *LocalSysTupCache::SearchLocalCatCTupleForProcAllArgs(
*/ */
if (likely(ct->global_ct != NULL)) { if (likely(ct->global_ct != NULL)) {
CACHE3_elog(DEBUG2, "SearchLocalCatCache(%s): found in bucket %d", m_relinfo.cc_relname, hash_index); CACHE3_elog(DEBUG2, "SearchLocalCatCache(%s): found in bucket %d", m_relinfo.cc_relname, hash_index);
ResourceOwnerEnlargeLocalCatCTup(LOCAL_SYSDB_RESOWNER);
ct->refcount++; ct->refcount++;
cc_hits++; cc_hits++;
ResourceOwnerRememberLocalCatCTup(LOCAL_SYSDB_RESOWNER, ct); ResourceOwnerRememberLocalCatCTup(LOCAL_SYSDB_RESOWNER, ct);
} }
if (unlikely(!found)) {
RemoveTailTupleElements(hash_index); RemoveTailTupleElements(hash_index);
}
pfree_ext(argModes); pfree_ext(argModes);
return ct; return ct;

View File

@ -136,4 +136,14 @@ struct InvalidBaseEntry {
void StreamTxnContextSaveInvalidMsg(void *stc); void StreamTxnContextSaveInvalidMsg(void *stc);
void StreamTxnContextRestoreInvalidMsg(void *stc); void StreamTxnContextRestoreInvalidMsg(void *stc);
#define EnableLocalSysCache() t_thrd.lsc_cxt.enable_lsc #define EnableLocalSysCache() t_thrd.lsc_cxt.enable_lsc
/*
* if MAX_LSC_SWAPOUT_RATIO is 0.9, MAX_LSC_FREESIZE_RATIO is 0.8
* used_space <= threshold * 0.9 < threshold ==> max_used_space = threshold * 0.8
* total_space > threshold >= total_space * 0.9 ==> max_total_space = threshold / 0.8
* so max_used_space = max_total_space * 0.72
* this means 72% memory can be used at the worst sence */
const double MAX_LSC_FREESIZE_RATIO = 0.2;
const double MAX_LSC_SWAPOUT_RATIO = 0.9;
const double MIN_LSC_SWAPOUT_RATIO = 0.7;
#endif #endif

View File

@ -214,8 +214,6 @@ public:
bool is_closed; bool is_closed;
/* mark pgxcpoolreload flag, flush relcache's locatorinfo->nodelist */ /* mark pgxcpoolreload flag, flush relcache's locatorinfo->nodelist */
bool got_pool_reload; bool got_pool_reload;
/* record other palloc on lsc */
int64 other_space;
/* record rel's index and rule cxt */ /* record rel's index and rule cxt */
int64 rel_index_rule_space; int64 rel_index_rule_space;
/* record abort count, which may cause memory leak /* record abort count, which may cause memory leak
@ -223,6 +221,7 @@ public:
uint64 abort_count; uint64 abort_count;
/* record concurrent rd locks on syscache */ /* record concurrent rd locks on syscache */
GSCRdLockInfo rdlock_info; GSCRdLockInfo rdlock_info;
double cur_swapout_ratio;
private: private:
void Init(); void Init();
void CreateCatBucket(); void CreateCatBucket();

View File

@ -1,24 +1,24 @@
select * from gs_gsc_dbstat_info() limit 1; select * from gs_gsc_dbstat_info() limit 1;
database_id | database_name | tup_searches | tup_hits | tup_miss | tup_count | tup_dead | tup_memory | rel_searches | rel_hits | rel_miss | rel_count | rel_dead | rel_memory | part_searches | part_hits | part_miss | part_count | part_dead | part_memory | total_memory | swapout_count | refcount --?.* database_id | database_name | tup_searches | tup_hits | tup_miss | tup_count | tup_dead | tup_memory | rel_searches | rel_hits | rel_miss | rel_count | rel_dead | rel_memory | part_searches | part_hits | part_miss | part_count | part_dead | part_memory | total_memory | swapout_count | refcount
-------------+---------------+--------------+----------+----------+-----------+----------+------------+--------------+----------+----------+-----------+----------+------------+---------------+-----------+-----------+------------+-----------+-------------+--------------+---------------+---------- --?.*-------------+---------------+--------------+----------+----------+-----------+----------+------------+--------------+----------+----------+-----------+----------+------------+---------------+-----------+-----------+------------+-----------+-------------+--------------+---------------+----------
--?.* 0 | | 40 | 23 | 9 | 7 | 0 | 3760 | 143 | 2 | 25 | 25 | 0 | 106656 | 0 | 0 | 0 | 0 | 0 | 0 | 405848 | 0 | 0 --?.* 0 | | 40 | 23 | 9 | 7 | 0 | 3760 | 143 | 2 | 25 | 25 | 0 | 106656 | 0 | 0 | 0 | 0 | 0 | 0 | 405848 | 0 | 0
(1 row) (1 row)
select * from gs_gsc_dbstat_info(-1) limit 1; select * from gs_gsc_dbstat_info(-1) limit 1;
database_id | database_name | tup_searches | tup_hits | tup_miss | tup_count | tup_dead | tup_memory | rel_searches | rel_hits | rel_miss | rel_count | rel_dead | rel_memory | part_searches | part_hits | part_miss | part_count | part_dead | part_memory | total_memory | swapout_count | refcount --?.* database_id | database_name | tup_searches | tup_hits | tup_miss | tup_count | tup_dead | tup_memory | rel_searches | rel_hits | rel_miss | rel_count | rel_dead | rel_memory | part_searches | part_hits | part_miss | part_count | part_dead | part_memory | total_memory | swapout_count | refcount
-------------+---------------+--------------+----------+----------+-----------+----------+------------+--------------+----------+----------+-----------+----------+------------+---------------+-----------+-----------+------------+-----------+-------------+--------------+---------------+---------- --?.*-------------+---------------+--------------+----------+----------+-----------+----------+------------+--------------+----------+----------+-----------+----------+------------+---------------+-----------+-----------+------------+-----------+-------------+--------------+---------------+----------
--?.* 0 | | 40 | 23 | 9 | 7 | 0 | 3760 | 143 | 2 | 25 | 25 | 0 | 106656 | 0 | 0 | 0 | 0 | 0 | 0 | 405848 | 0 | 0 --?.* 0 | | 40 | 23 | 9 | 7 | 0 | 3760 | 143 | 2 | 25 | 25 | 0 | 106656 | 0 | 0 | 0 | 0 | 0 | 0 | 405848 | 0 | 0
(1 row) (1 row)
select * from gs_gsc_dbstat_info(0) limit 1; select * from gs_gsc_dbstat_info(0) limit 1;
database_id | database_name | tup_searches | tup_hits | tup_miss | tup_count | tup_dead | tup_memory | rel_searches | rel_hits | rel_miss | rel_count | rel_dead | rel_memory | part_searches | part_hits | part_miss | part_count | part_dead | part_memory | total_memory | swapout_count | refcount --?.* database_id | database_name | tup_searches | tup_hits | tup_miss | tup_count | tup_dead | tup_memory | rel_searches | rel_hits | rel_miss | rel_count | rel_dead | rel_memory | part_searches | part_hits | part_miss | part_count | part_dead | part_memory | total_memory | swapout_count | refcount
-------------+---------------+--------------+----------+----------+-----------+----------+------------+--------------+----------+----------+-----------+----------+------------+---------------+-----------+-----------+------------+-----------+-------------+--------------+---------------+---------- --?.*-------------+---------------+--------------+----------+----------+-----------+----------+------------+--------------+----------+----------+-----------+----------+------------+---------------+-----------+-----------+------------+-----------+-------------+--------------+---------------+----------
--?.* 0 | | 40 | 23 | 9 | 7 | 0 | 3760 | 143 | 2 | 25 | 25 | 0 | 106656 | 0 | 0 | 0 | 0 | 0 | 0 | 405848 | 0 | 0 --?.* 0 | | 40 | 23 | 9 | 7 | 0 | 3760 | 143 | 2 | 25 | 25 | 0 | 106656 | 0 | 0 | 0 | 0 | 0 | 0 | 405848 | 0 | 0
(1 row) (1 row)
select * from gs_gsc_dbstat_info(1) limit 1; select * from gs_gsc_dbstat_info(1) limit 1;
database_id | database_name | tup_searches | tup_hits | tup_miss | tup_count | tup_dead | tup_memory | rel_searches | rel_hits | rel_miss | rel_count | rel_dead | rel_memory | part_searches | part_hits | part_miss | part_count | part_dead | part_memory | total_memory | swapout_count | refcount --?.* database_id | database_name | tup_searches | tup_hits | tup_miss | tup_count | tup_dead | tup_memory | rel_searches | rel_hits | rel_miss | rel_count | rel_dead | rel_memory | part_searches | part_hits | part_miss | part_count | part_dead | part_memory | total_memory | swapout_count | refcount
-------------+---------------+--------------+----------+----------+-----------+----------+------------+--------------+----------+----------+-----------+----------+------------+---------------+-----------+-----------+------------+-----------+-------------+--------------+---------------+---------- --?.*-------------+---------------+--------------+----------+----------+-----------+----------+------------+--------------+----------+----------+-----------+----------+------------+---------------+-----------+-----------+------------+-----------+-------------+--------------+---------------+----------
--?.* 0 | | 40 | 23 | 9 | 7 | 0 | 3760 | 143 | 2 | 25 | 25 | 0 | 106656 | 0 | 0 | 0 | 0 | 0 | 0 | 405848 | 0 | 0 --?.* 0 | | 40 | 23 | 9 | 7 | 0 | 3760 | 143 | 2 | 25 | 25 | 0 | 106656 | 0 | 0 | 0 | 0 | 0 | 0 | 405848 | 0 | 0
(1 row) (1 row)
@ -26,121 +26,121 @@ select * from gs_gsc_dbstat_info(2) limit 1;
ERROR: dbOid doesn't exist. ERROR: dbOid doesn't exist.
DETAIL: dbOid is invalid, please pass valid dbOid. DETAIL: dbOid is invalid, please pass valid dbOid.
select * from gs_gsc_catalog_detail() limit 1; select * from gs_gsc_catalog_detail() limit 1;
database_id | database_name | rel_id | rel_name | cache_id | self | ctid | infomask | infomask2 | hash_value | refcount --?.* database_id | database_name | rel_id | rel_name | cache_id | self | ctid | infomask | infomask2 | hash_value | refcount
-------------+---------------+--------+-----------+----------+--------+--------+----------+-----------+------------+---------- --?.*-------------+---------------+--------+-----------+----------+--------+--------+----------+-----------+------------+----------
--?.* 0 | | 1260 | pg_authid | 10 | (0, 9) | (0, 9) | 10507 | 26 | 531311568 | 9 --?.* 0 | | 1260 | pg_authid | 10 | (0, 9) | (0, 9) | 10507 | 26 | 531311568 | 9
(1 row) (1 row)
select * from gs_gsc_catalog_detail(-1) limit 1; select * from gs_gsc_catalog_detail(-1) limit 1;
database_id | database_name | rel_id | rel_name | cache_id | self | ctid | infomask | infomask2 | hash_value | refcount --?.* database_id | database_name | rel_id | rel_name | cache_id | self | ctid | infomask | infomask2 | hash_value | refcount
-------------+---------------+--------+-----------+----------+--------+--------+----------+-----------+------------+---------- --?.*-------------+---------------+--------+-----------+----------+--------+--------+----------+-----------+------------+----------
--?.* 0 | | 1260 | pg_authid | 10 | (0, 9) | (0, 9) | 10507 | 26 | 531311568 | 9 --?.* 0 | | 1260 | pg_authid | 10 | (0, 9) | (0, 9) | 10507 | 26 | 531311568 | 9
(1 row) (1 row)
select * from gs_gsc_catalog_detail(0) limit 1; select * from gs_gsc_catalog_detail(0) limit 1;
database_id | database_name | rel_id | rel_name | cache_id | self | ctid | infomask | infomask2 | hash_value | refcount --?.* database_id | database_name | rel_id | rel_name | cache_id | self | ctid | infomask | infomask2 | hash_value | refcount
-------------+---------------+--------+-----------+----------+--------+--------+----------+-----------+------------+---------- --?.*-------------+---------------+--------+-----------+----------+--------+--------+----------+-----------+------------+----------
--?.* 0 | | 1260 | pg_authid | 10 | (0, 9) | (0, 9) | 10507 | 26 | 531311568 | 9 --?.* 0 | | 1260 | pg_authid | 10 | (0, 9) | (0, 9) | 10507 | 26 | 531311568 | 9
(1 row) (1 row)
select * from gs_gsc_catalog_detail(1) limit 1; select * from gs_gsc_catalog_detail(1) limit 1;
database_id | database_name | rel_id | rel_name | cache_id | self | ctid | infomask | infomask2 | hash_value | refcount --?.* database_id | database_name | rel_id | rel_name | cache_id | self | ctid | infomask | infomask2 | hash_value | refcount
-------------+---------------+--------+-----------+----------+--------+--------+----------+-----------+------------+---------- --?.*-------------+---------------+--------+-----------+----------+--------+--------+----------+-----------+------------+----------
--?.* 0 | | 1260 | pg_authid | 10 | (0, 9) | (0, 9) | 10507 | 26 | 531311568 | 9 --?.* 0 | | 1260 | pg_authid | 10 | (0, 9) | (0, 9) | 10507 | 26 | 531311568 | 9
(1 row) (1 row)
select * from gs_gsc_catalog_detail(-1, 1262) limit 1; select * from gs_gsc_catalog_detail(-1, 1262) limit 1;
database_id | database_name | rel_id | rel_name | cache_id | self | ctid | infomask | infomask2 | hash_value | refcount --?.* database_id | database_name | rel_id | rel_name | cache_id | self | ctid | infomask | infomask2 | hash_value | refcount
-------------+---------------+--------+-------------+----------+--------+--------+----------+-----------+------------+---------- --?.*-------------+---------------+--------+-------------+----------+--------+--------+----------+-----------+------------+----------
--?.* 0 | | 1262 | pg_database | 27 | (0, 4) | (0, 4) | 10506 | 15 | 361410604 | 1 --?.* 0 | | 1262 | pg_database | 27 | (0, 4) | (0, 4) | 10506 | 15 | 361410604 | 1
(1 row) (1 row)
select * from gs_gsc_catalog_detail(0, 1262) limit 1; select * from gs_gsc_catalog_detail(0, 1262) limit 1;
database_id | database_name | rel_id | rel_name | cache_id | self | ctid | infomask | infomask2 | hash_value | refcount --?.* database_id | database_name | rel_id | rel_name | cache_id | self | ctid | infomask | infomask2 | hash_value | refcount
-------------+---------------+--------+-------------+----------+--------+--------+----------+-----------+------------+---------- --?.*-------------+---------------+--------+-------------+----------+--------+--------+----------+-----------+------------+----------
--?.* 0 | | 1262 | pg_database | 27 | (0, 4) | (0, 4) | 10506 | 15 | 361410604 | 1 --?.* 0 | | 1262 | pg_database | 27 | (0, 4) | (0, 4) | 10506 | 15 | 361410604 | 1
(1 row) (1 row)
select * from gs_gsc_catalog_detail(1, 1262) limit 1; select * from gs_gsc_catalog_detail(1, 1262) limit 1;
database_id | database_name | rel_id | rel_name | cache_id | self | ctid | infomask | infomask2 | hash_value | refcount --?.* database_id | database_name | rel_id | rel_name | cache_id | self | ctid | infomask | infomask2 | hash_value | refcount
-------------+---------------+--------+-------------+----------+--------+--------+----------+-----------+------------+---------- --?.*-------------+---------------+--------+-------------+----------+--------+--------+----------+-----------+------------+----------
--?.* 0 | | 1262 | pg_database | 27 | (0, 4) | (0, 4) | 10506 | 15 | 361410604 | 1 --?.* 0 | | 1262 | pg_database | 27 | (0, 4) | (0, 4) | 10506 | 15 | 361410604 | 1
(1 row) (1 row)
select * from gs_gsc_catalog_detail(-1, 1259) limit 1; select * from gs_gsc_catalog_detail(-1, 1259) limit 1;
--?.* database_id | database_name | rel_id | rel_name | cache_id | self | ctid | infomask | infomask2 | hash_value | refcount --?.* database_id | database_name | rel_id | rel_name | cache_id | self | ctid | infomask | infomask2 | hash_value | refcount
--?.*-------------+---------------+--------+----------+----------+---------+---------+----------+-----------+------------+---------- --?.*-------------+---------------+--------+----------+----------+--------+--------+----------+-----------+------------+----------
--?.* 16299 | postgres | 1259 | pg_class | 84 | (7, 3) | (7, 3) | 10507 | 40 | 1520565747 | 0 --?.* 16299 | postgres | 1259 | pg_class | 84 | (7, 3) | (7, 3) | 10507 | 40 | 1520565747 | 0
(1 row) (1 row)
select * from gs_gsc_catalog_detail(0, 1259) limit 1; select * from gs_gsc_catalog_detail(0, 1259) limit 1;
database_id | database_name | rel_id | rel_name | cache_id | self | ctid | infomask | infomask2 | hash_value | refcount --?.* database_id | database_name | rel_id | rel_name | cache_id | self | ctid | infomask | infomask2 | hash_value | refcount
-------------+---------------+--------+----------+----------+------+------+----------+-----------+------------+---------- --?.*-------------+---------------+--------+----------+----------+------+------+----------+-----------+------------+----------
(0 rows) (0 rows)
select * from gs_gsc_catalog_detail(1, 1259) limit 1; select * from gs_gsc_catalog_detail(1, 1259) limit 1;
database_id | database_name | rel_id | rel_name | cache_id | self | ctid | infomask | infomask2 | hash_value | refcount --?.* database_id | database_name | rel_id | rel_name | cache_id | self | ctid | infomask | infomask2 | hash_value | refcount
-------------+---------------+--------+----------+----------+------+------+----------+-----------+------------+---------- --?.*-------------+---------------+--------+----------+----------+------+------+----------+-----------+------------+----------
(0 rows) (0 rows)
select * from gs_gsc_catalog_detail(2, 1259) limit 1; select * from gs_gsc_catalog_detail(2, 1259) limit 1;
ERROR: dbOid doesn't exist. ERROR: dbOid doesn't exist.
DETAIL: dbOid is invalid, please pass valid dbOid. DETAIL: dbOid is invalid, please pass valid dbOid.
select * from gs_gsc_table_detail() limit 1; select * from gs_gsc_table_detail() limit 1;
database_oid | database_name | reloid | relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | reltablespace | relhasindex | relisshared | relkind | relnatts | relhasoids | relhaspkey | parttype | tdhasuids | attnames | extinfo --?.* database_oid | database_name | reloid | relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | reltablespace | relhasindex | relisshared | relkind | relnatts | relhasoids | relhaspkey | parttype | tdhasuids | attnames | extinfo
--------------+---------------+--------+-------------------------+--------------+---------+-----------+----------+-------+-------------+---------------+-------------+-------------+---------+----------+------------+------------+----------+-----------+-----------+--------- --?.*--------------+---------------+--------+-------------------------+--------------+---------+-----------+----------+-------+-------------+---------------+-------------+-------------+---------+----------+------------+------------+----------+-----------+-----------+---------
--?.* 0 | | 2676 | pg_authid_rolname_index | 11 | 0 | 0 | 10 | 403 | 0 | 1664 | f | t | i | 1 | f | f | n | f | 'rolname' | --?.* 0 | | 2676 | pg_authid_rolname_index | 11 | 0 | 0 | 10 | 403 | 0 | 1664 | f | t | i | 1 | f | f | n | f | 'rolname' |
(1 row) (1 row)
select * from gs_gsc_table_detail(-1) limit 1; select * from gs_gsc_table_detail(-1) limit 1;
database_oid | database_name | reloid | relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | reltablespace | relhasindex | relisshared | relkind | relnatts | relhasoids | relhaspkey | parttype | tdhasuids | attnames | extinfo --?.* database_oid | database_name | reloid | relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | reltablespace | relhasindex | relisshared | relkind | relnatts | relhasoids | relhaspkey | parttype | tdhasuids | attnames | extinfo
--------------+---------------+--------+-------------------------+--------------+---------+-----------+----------+-------+-------------+---------------+-------------+-------------+---------+----------+------------+------------+----------+-----------+-----------+--------- --?.*--------------+---------------+--------+-------------------------+--------------+---------+-----------+----------+-------+-------------+---------------+-------------+-------------+---------+----------+------------+------------+----------+-----------+-----------+---------
--?.* 0 | | 2676 | pg_authid_rolname_index | 11 | 0 | 0 | 10 | 403 | 0 | 1664 | f | t | i | 1 | f | f | n | f | 'rolname' | --?.* 0 | | 2676 | pg_authid_rolname_index | 11 | 0 | 0 | 10 | 403 | 0 | 1664 | f | t | i | 1 | f | f | n | f | 'rolname' |
(1 row) (1 row)
select * from gs_gsc_table_detail(0) limit 1; select * from gs_gsc_table_detail(0) limit 1;
database_oid | database_name | reloid | relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | reltablespace | relhasindex | relisshared | relkind | relnatts | relhasoids | relhaspkey | parttype | tdhasuids | attnames | extinfo --?.* database_oid | database_name | reloid | relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | reltablespace | relhasindex | relisshared | relkind | relnatts | relhasoids | relhaspkey | parttype | tdhasuids | attnames | extinfo
--------------+---------------+--------+-------------------------+--------------+---------+-----------+----------+-------+-------------+---------------+-------------+-------------+---------+----------+------------+------------+----------+-----------+-----------+--------- --?.*--------------+---------------+--------+-------------------------+--------------+---------+-----------+----------+-------+-------------+---------------+-------------+-------------+---------+----------+------------+------------+----------+-----------+-----------+---------
--?.* 0 | | 2676 | pg_authid_rolname_index | 11 | 0 | 0 | 10 | 403 | 0 | 1664 | f | t | i | 1 | f | f | n | f | 'rolname' | --?.* 0 | | 2676 | pg_authid_rolname_index | 11 | 0 | 0 | 10 | 403 | 0 | 1664 | f | t | i | 1 | f | f | n | f | 'rolname' |
(1 row) (1 row)
select * from gs_gsc_table_detail(1) limit 1; select * from gs_gsc_table_detail(1) limit 1;
database_oid | database_name | reloid | relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | reltablespace | relhasindex | relisshared | relkind | relnatts | relhasoids | relhaspkey | parttype | tdhasuids | attnames | extinfo --?.* database_oid | database_name | reloid | relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | reltablespace | relhasindex | relisshared | relkind | relnatts | relhasoids | relhaspkey | parttype | tdhasuids | attnames | extinfo
--------------+---------------+--------+-------------------------+--------------+---------+-----------+----------+-------+-------------+---------------+-------------+-------------+---------+----------+------------+------------+----------+-----------+-----------+--------- --?.*--------------+---------------+--------+-------------------------+--------------+---------+-----------+----------+-------+-------------+---------------+-------------+-------------+---------+----------+------------+------------+----------+-----------+-----------+---------
--?.* 0 | | 2676 | pg_authid_rolname_index | 11 | 0 | 0 | 10 | 403 | 0 | 1664 | f | t | i | 1 | f | f | n | f | 'rolname' | --?.* 0 | | 2676 | pg_authid_rolname_index | 11 | 0 | 0 | 10 | 403 | 0 | 1664 | f | t | i | 1 | f | f | n | f | 'rolname' |
(1 row) (1 row)
select * from gs_gsc_table_detail(-1, 1262) limit 1; select * from gs_gsc_table_detail(-1, 1262) limit 1;
database_oid | database_name | reloid | relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | reltablespace | relhasindex | relisshared | relkind | relnatts | relhasoids | relhaspkey | parttype | tdhasuids | attnames | extinfo --?.* database_oid | database_name | reloid | relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | reltablespace | relhasindex | relisshared | relkind | relnatts | relhasoids | relhaspkey | parttype | tdhasuids | attnames | extinfo
--------------+---------------+--------+-------------+--------------+---------+-----------+----------+-------+-------------+---------------+-------------+-------------+---------+----------+------------+------------+----------+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------- --?.*--------------+---------------+--------+-------------+--------------+---------+-----------+----------+-------+-------------+---------------+-------------+-------------+---------+----------+------------+------------+----------+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------
--?.* 0 | | 1262 | pg_database | 11 | 1248 | 0 | 10 | 0 | 0 | 1664 | t | t | r | 15 | t | f | n | f | 'datname','datdba','encoding','datcollate','datctype','datistemplate','datallowconn','datconnlimit','datlastsysoid','datfrozenxid','dattablespace','datcompatibility','datacl','datfrozenxid64','datminmxid' | --?.* 0 | | 1262 | pg_database | 11 | 1248 | 0 | 10 | 0 | 0 | 1664 | t | t | r | 15 | t | f | n | f | 'datname','datdba','encoding','datcollate','datctype','datistemplate','datallowconn','datconnlimit','datlastsysoid','datfrozenxid','dattablespace','datcompatibility','datacl','datfrozenxid64','datminmxid' |
(1 row) (1 row)
select * from gs_gsc_table_detail(0, 1262) limit 1; select * from gs_gsc_table_detail(0, 1262) limit 1;
database_oid | database_name | reloid | relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | reltablespace | relhasindex | relisshared | relkind | relnatts | relhasoids | relhaspkey | parttype | tdhasuids | attnames | extinfo --?.* database_oid | database_name | reloid | relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | reltablespace | relhasindex | relisshared | relkind | relnatts | relhasoids | relhaspkey | parttype | tdhasuids | attnames | extinfo
--------------+---------------+--------+-------------+--------------+---------+-----------+----------+-------+-------------+---------------+-------------+-------------+---------+----------+------------+------------+----------+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------- --?.*--------------+---------------+--------+-------------+--------------+---------+-----------+----------+-------+-------------+---------------+-------------+-------------+---------+----------+------------+------------+----------+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------
--?.* 0 | | 1262 | pg_database | 11 | 1248 | 0 | 10 | 0 | 0 | 1664 | t | t | r | 15 | t | f | n | f | 'datname','datdba','encoding','datcollate','datctype','datistemplate','datallowconn','datconnlimit','datlastsysoid','datfrozenxid','dattablespace','datcompatibility','datacl','datfrozenxid64','datminmxid' | --?.* 0 | | 1262 | pg_database | 11 | 1248 | 0 | 10 | 0 | 0 | 1664 | t | t | r | 15 | t | f | n | f | 'datname','datdba','encoding','datcollate','datctype','datistemplate','datallowconn','datconnlimit','datlastsysoid','datfrozenxid','dattablespace','datcompatibility','datacl','datfrozenxid64','datminmxid' |
(1 row) (1 row)
select * from gs_gsc_table_detail(1, 1262) limit 1; select * from gs_gsc_table_detail(1, 1262) limit 1;
database_oid | database_name | reloid | relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | reltablespace | relhasindex | relisshared | relkind | relnatts | relhasoids | relhaspkey | parttype | tdhasuids | attnames | extinfo --?.* database_oid | database_name | reloid | relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | reltablespace | relhasindex | relisshared | relkind | relnatts | relhasoids | relhaspkey | parttype | tdhasuids | attnames | extinfo
--------------+---------------+--------+-------------+--------------+---------+-----------+----------+-------+-------------+---------------+-------------+-------------+---------+----------+------------+------------+----------+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------- --?.*--------------+---------------+--------+-------------+--------------+---------+-----------+----------+-------+-------------+---------------+-------------+-------------+---------+----------+------------+------------+----------+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------
--?.* 0 | | 1262 | pg_database | 11 | 1248 | 0 | 10 | 0 | 0 | 1664 | t | t | r | 15 | t | f | n | f | 'datname','datdba','encoding','datcollate','datctype','datistemplate','datallowconn','datconnlimit','datlastsysoid','datfrozenxid','dattablespace','datcompatibility','datacl','datfrozenxid64','datminmxid' | --?.* 0 | | 1262 | pg_database | 11 | 1248 | 0 | 10 | 0 | 0 | 1664 | t | t | r | 15 | t | f | n | f | 'datname','datdba','encoding','datcollate','datctype','datistemplate','datallowconn','datconnlimit','datlastsysoid','datfrozenxid','dattablespace','datcompatibility','datacl','datfrozenxid64','datminmxid' |
(1 row) (1 row)
select * from gs_gsc_table_detail(-1, 1259) limit 1; select * from gs_gsc_table_detail(-1, 1259) limit 1;
database_oid | database_name | reloid | relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | reltablespace | relhasindex | relisshared | relkind | relnatts | relhasoids | relhaspkey | parttype | tdhasuids | attnames | extinfo --?.* database_oid | database_name | reloid | relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | reltablespace | relhasindex | relisshared | relkind | relnatts | relhasoids | relhaspkey | parttype | tdhasuids | attnames | extinfo
--------------+---------------+--------+----------+--------------+---------+-----------+----------+-------+-------------+---------------+-------------+-------------+---------+----------+------------+------------+----------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------- --?.*--------------+---------------+--------+----------+--------------+---------+-----------+----------+-------+-------------+---------------+-------------+-------------+---------+----------+------------+------------+----------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------
--?.* 16384 | regression | 1259 | pg_class | 11 | 83 | 0 | 10 | 0 | 0 | 0 | t | f | r | 40 | t | f | n | f | 'relname','relnamespace','reltype','reloftype','relowner','relam','relfilenode','reltablespace','relpages','reltuples','relallvisible','reltoastrelid','reltoastidxid','reldeltarelid','reldeltaidx','relcudescrelid','relcudescidx','relhasindex','relisshared','relpersistence','relkind','relnatts','relchecks','relhasoids','relhaspkey','relhasrules','relhastriggers','relhassubclass','relcmprs','relhasclusterkey','relrowmovement','parttype','relfrozenxid','relacl','reloptions','relreplident','relfrozenxid64','relbucket','relbucketkey','relminmxid' | --?.* 16384 | regression | 1259 | pg_class | 11 | 83 | 0 | 10 | 0 | 0 | 0 | t | f | r | 40 | t | f | n | f | 'relname','relnamespace','reltype','reloftype','relowner','relam','relfilenode','reltablespace','relpages','reltuples','relallvisible','reltoastrelid','reltoastidxid','reldeltarelid','reldeltaidx','relcudescrelid','relcudescidx','relhasindex','relisshared','relpersistence','relkind','relnatts','relchecks','relhasoids','relhaspkey','relhasrules','relhastriggers','relhassubclass','relcmprs','relhasclusterkey','relrowmovement','parttype','relfrozenxid','relacl','reloptions','relreplident','relfrozenxid64','relbucket','relbucketkey','relminmxid' |
(1 row) (1 row)
select * from gs_gsc_table_detail(0, 1259) limit 1; select * from gs_gsc_table_detail(0, 1259) limit 1;
database_oid | database_name | reloid | relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | reltablespace | relhasindex | relisshared | relkind | relnatts | relhasoids | relhaspkey | parttype | tdhasuids | attnames | extinfo --?.* database_oid | database_name | reloid | relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | reltablespace | relhasindex | relisshared | relkind | relnatts | relhasoids | relhaspkey | parttype | tdhasuids | attnames | extinfo
--------------+---------------+--------+---------+--------------+---------+-----------+----------+-------+-------------+---------------+-------------+-------------+---------+----------+------------+------------+----------+-----------+----------+--------- --------------+---------------+--------+---------+--------------+---------+-----------+----------+-------+-------------+---------------+-------------+-------------+---------+----------+------------+------------+----------+-----------+----------+---------
(0 rows) (0 rows)
select * from gs_gsc_table_detail(1, 1259) limit 1; select * from gs_gsc_table_detail(1, 1259) limit 1;
database_oid | database_name | reloid | relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | reltablespace | relhasindex | relisshared | relkind | relnatts | relhasoids | relhaspkey | parttype | tdhasuids | attnames | extinfo --?.* database_oid | database_name | reloid | relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | reltablespace | relhasindex | relisshared | relkind | relnatts | relhasoids | relhaspkey | parttype | tdhasuids | attnames | extinfo
--------------+---------------+--------+---------+--------------+---------+-----------+----------+-------+-------------+---------------+-------------+-------------+---------+----------+------------+------------+----------+-----------+----------+--------- --------------+---------------+--------+---------+--------------+---------+-----------+----------+-------+-------------+---------------+-------------+-------------+---------+----------+------------+------------+----------+-----------+----------+---------
(0 rows) (0 rows)