Merged PR 4326: Remove cancelled Bookings. Adds index in mtd_aggregated_metrics
# Description Main changes: * Remove Cancelled Bookings previous logic. * Speeds up Main KPIs by adding a couple of indexes in `mtd_aggregated_metrics`. Tested in prod, to me it looks like it's quite fast now. # Checklist - [X] The edited models and dependants run properly with production data. - [X] The edited models are sufficiently documented. - [X] The edited models contain PK tests, and I've ran and passed them. - [X] I have checked for DRY opportunities with other models and docs. - [X] I've picked the right materialization for the affected models. # Other - [ ] Check if a full-refresh is required after this PR is merged. Related work items: #24637
This commit is contained in:
parent
167261b9ee
commit
45d8224416
9 changed files with 9 additions and 461 deletions
|
|
@ -30,19 +30,6 @@ with
|
|||
dimension in ('global', 'by_number_of_listings', 'by_billing_country')
|
||||
and dimension_value <> 'UNSET'
|
||||
),
|
||||
cancelled_bookings as (
|
||||
select *
|
||||
from {{ ref("int_kpis__agg_mtd_cancelled_bookings") }}
|
||||
where
|
||||
dimension in ('global', 'by_number_of_listings', 'by_billing_country')
|
||||
and dimension_value <> 'UNSET'
|
||||
union all
|
||||
select *
|
||||
from {{ ref("int_kpis__agg_monthly_cancelled_bookings") }}
|
||||
where
|
||||
dimension in ('global', 'by_number_of_listings', 'by_billing_country')
|
||||
and dimension_value <> 'UNSET'
|
||||
),
|
||||
billable_bookings as (
|
||||
select *
|
||||
from {{ ref("int_kpis__agg_mtd_billable_bookings") }}
|
||||
|
|
@ -205,7 +192,6 @@ with
|
|||
check_out_bookings.cancelled_check_out_bookings_rate,
|
||||
|
||||
-- OTHER BOOKINGS --
|
||||
cancelled_bookings.cancelled_bookings,
|
||||
billable_bookings.billable_bookings,
|
||||
|
||||
-- GUEST JOURNEYS --
|
||||
|
|
@ -399,11 +385,6 @@ with
|
|||
on d.date = check_out_bookings.end_date
|
||||
and d.dimension = check_out_bookings.dimension
|
||||
and d.dimension_value = check_out_bookings.dimension_value
|
||||
left join
|
||||
cancelled_bookings
|
||||
on d.date = cancelled_bookings.end_date
|
||||
and d.dimension = cancelled_bookings.dimension
|
||||
and d.dimension_value = cancelled_bookings.dimension_value
|
||||
left join
|
||||
billable_bookings
|
||||
on d.date = billable_bookings.end_date
|
||||
|
|
@ -497,7 +478,6 @@ select
|
|||
{{ calculate_safe_relative_increment("cancelled_check_out_bookings_rate") }},
|
||||
|
||||
-- OTHER BOOKINGS --
|
||||
{{ calculate_safe_relative_increment("cancelled_bookings") }},
|
||||
{{ calculate_safe_relative_increment("billable_bookings") }},
|
||||
|
||||
-- GUEST JOURNEYS --
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue