Skip to content

Commit

Permalink
Rely on powa_databases rather than powa_catalog_databases (#268)
Browse files Browse the repository at this point in the history
The catalog tables are not refreshed very often (the default is every month),
so we shouldn't rely on them when displaying information that doesn't also come
from the catalogs.
  • Loading branch information
rjuju authored Feb 16, 2025
1 parent 7c623f4 commit f309d9b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions powa/sql/views_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ def kcache_getstatdata_sample(mode, predicates=[]):
# the highest transaction id is 2^32.
def BASE_QUERY_PGSA_SAMPLE(per_db=False):
if per_db:
extra = """JOIN {powa}.powa_catalog_databases d
extra = """JOIN {powa}.powa_databases d
ON d.oid = pgsa_history.datid and d.srvid = pgsa_history.srvid
WHERE d.datname = %(database)s"""
else:
Expand Down Expand Up @@ -645,7 +645,7 @@ def BASE_QUERY_PGSA_SAMPLE(per_db=False):

def BASE_QUERY_DATABASE_SAMPLE(per_db=False):
if per_db:
extra = """JOIN {powa}.powa_catalog_databases d
extra = """JOIN {powa}.powa_databases d
ON d.oid = psd_history.datid and d.srvid = psd_history.srvid
WHERE d.datname = %(database)s"""
else:
Expand Down Expand Up @@ -706,7 +706,7 @@ def BASE_QUERY_DATABASE_SAMPLE(per_db=False):

def BASE_QUERY_DATABASE_CONFLICTS_SAMPLE(per_db=False):
if per_db:
extra = """JOIN {powa}.powa_catalog_databases d
extra = """JOIN {powa}.powa_databases d
ON d.oid = psd_history.datid and d.srvid = psd_history.srvid
WHERE d.datname = %(database)s"""
else:
Expand Down
4 changes: 2 additions & 2 deletions powa/sql/views_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -938,8 +938,8 @@ def powa_getuserfuncdata_detailed_db(funcid=None):
groupby.extend(["prosrc", "last_refresh"])

if funcid:
join_db = """LEFT JOIN {powa}.powa_catalog_databases pcd
ON pcd.srvid = d.srvid AND pcd.oid = h.dbid"""
join_db = """INNER JOIN {powa}.powa_databases pd
ON pd.srvid = d.srvid AND pd.oid = h.dbid"""
and_funcid = "AND funcid = {funcid}".format(funcid=funcid)
else:
join_db = ""
Expand Down

0 comments on commit f309d9b

Please sign in to comment.