Skip to content

Instantly share code, notes, and snippets.

@nakolkin
Created September 22, 2015 08:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nakolkin/4be342d56fb080a45cd6 to your computer and use it in GitHub Desktop.
Save nakolkin/4be342d56fb080a45cd6 to your computer and use it in GitHub Desktop.
CREATE TABLE summary_v2.campaign_dashboard_daily_v2
(
report_date date NOT NULL,
third_party_adserver_id bigint NOT NULL,
campaign_id bigint NOT NULL,
impression_by_flavor summary_v2.impression[],
impressions_total bigint NOT NULL DEFAULT 0,
uu_impression_total bytea NOT NULL DEFAULT '\000'::bytea,
engagement_by_type summary_v2.engagement[],
engagement_by_flavor summary_v2.engagement[],
click_engagement_count bigint NOT NULL DEFAULT 0,
ak_uu_click_engagement_count bytea NOT NULL DEFAULT '\000'::bytea,
impression_attributed_conversions summary_v2.conversion_flavor[],
engagement_attributed_conversions summary_v2.conversion_flavor[],
impression_attributed_conversions_total bigint NOT NULL DEFAULT 0,
attributed_conversions_total bigint NOT NULL DEFAULT 0,
uu_attributed_conversions_total bytea NOT NULL DEFAULT '\000'::bytea,
click_engagement_attributed_conversion_count bigint NOT NULL DEFAULT 0,
ak_uu_click_engagement_attributed_conversion_count bytea NOT NULL DEFAULT '\000'::bytea,
adv_impression_attributed_conversions bigint,
adv_click_attributed_conversions bigint,
raw_adv_impression_attributed_conversions bigint,
raw_adv_click_attributed_conversions bigint,
raw_total_impression_attributed_conversions bigint,
raw_total_attributed_conversions bigint,
raw_click_engagement_attributed_conversion_count bigint,
adv_uu_attributed_conversions_total bytea,
adv_impression_attributed_conversions_by_type summary_v2.conversion_type_detail[],
adv_engagement_attributed_conversions_by_type summary_v2.conversion_type_detail[],
CONSTRAINT campaign_dashboard_daily_v2_pkey1 PRIMARY KEY (report_date, third_party_adserver_id, campaign_id)
)
WITH (
OIDS=FALSE
);
ALTER TABLE summary_v2.campaign_dashboard_daily_v2
OWNER TO summary_rw;
GRANT ALL ON TABLE summary_v2.campaign_dashboard_daily_v2 TO summary_rw;
GRANT SELECT ON TABLE summary_v2.campaign_dashboard_daily_v2 TO summary_r;
GRANT SELECT ON TABLE summary_v2.campaign_dashboard_daily_v2 TO support;
GRANT SELECT ON TABLE summary_v2.campaign_dashboard_daily_v2 TO metadata_uploader;
-- Index: summary_v2.cd_v2_daily_campaign_id_idx
-- DROP INDEX summary_v2.cd_v2_daily_campaign_id_idx;
CREATE INDEX cd_v2_daily_campaign_id_idx
ON summary_v2.campaign_dashboard_daily_v2
USING btree
(third_party_adserver_id, campaign_id);
-- Index: summary_v2.cd_v2_daily_report_date_idx
-- DROP INDEX summary_v2.cd_v2_daily_report_date_idx;
CREATE INDEX cd_v2_daily_report_date_idx
ON summary_v2.campaign_dashboard_daily_v2
USING btree
(report_date);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment