Skip to content

Commit

Permalink
Unique indexes for MV for UI
Browse files Browse the repository at this point in the history
  • Loading branch information
ddxv committed Oct 20, 2023
1 parent 1ffd135 commit 9feb7de
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions pg-ddl/db.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1174,7 +1174,7 @@ ORDER BY
cm.mapped_category
;

--DROP MATERIALIZED VIEW new_weekly_apps;
--DROP MATERIALIZED VIEW apps_new_weekly;
CREATE MATERIALIZED VIEW apps_new_weekly AS
WITH RankedApps AS (
SELECT
Expand All @@ -1197,8 +1197,14 @@ FROM
WHERE
rn <= 100
;
REFRESH MATERIALIZED VIEW apps_new_weekly ;
--REFRESH MATERIALIZED VIEW apps_new_weekly ;

DROP INDEX IF EXISTS idx_apps_new_weekly;
CREATE UNIQUE INDEX idx_apps_new_weekly
ON apps_new_weekly (store, store_id);


--DROP MATERIALIZED VIEW IF EXISTS apps_new_monthly;
CREATE MATERIALIZED VIEW apps_new_monthly AS
WITH RankedApps AS (
SELECT
Expand All @@ -1221,8 +1227,11 @@ FROM
WHERE
rn <= 100
;
--DROP INDEX IF EXISTS idx_apps_new_monthly;
CREATE UNIQUE INDEX idx_apps_new_monthly
ON apps_new_monthly (store, store_id);


REFRESH MATERIALIZED VIEW apps_new_monthly ;


CREATE OR REPLACE FUNCTION public.pg_stat_statements(showtext boolean, OUT userid oid, OUT dbid oid, OUT toplevel boolean, OUT queryid bigint, OUT query text, OUT plans bigint, OUT total_plan_time double precision, OUT min_plan_time double precision, OUT max_plan_time double precision, OUT mean_plan_time double precision, OUT stddev_plan_time double precision, OUT calls bigint, OUT total_exec_time double precision, OUT min_exec_time double precision, OUT max_exec_time double precision, OUT mean_exec_time double precision, OUT stddev_exec_time double precision, OUT rows bigint, OUT shared_blks_hit bigint, OUT shared_blks_read bigint, OUT shared_blks_dirtied bigint, OUT shared_blks_written bigint, OUT local_blks_hit bigint, OUT local_blks_read bigint, OUT local_blks_dirtied bigint, OUT local_blks_written bigint, OUT temp_blks_read bigint, OUT temp_blks_written bigint, OUT blk_read_time double precision, OUT blk_write_time double precision, OUT temp_blk_read_time double precision, OUT temp_blk_write_time double precision, OUT wal_records bigint, OUT wal_fpi bigint, OUT wal_bytes numeric, OUT jit_functions bigint, OUT jit_generation_time double precision, OUT jit_inlining_count bigint, OUT jit_inlining_time double precision, OUT jit_optimization_count bigint, OUT jit_optimization_time double precision, OUT jit_emission_count bigint, OUT jit_emission_time double precision)
Expand Down

0 comments on commit 9feb7de

Please sign in to comment.