Merged PR 4959: Exclude data from model to improve performance
# Description Small changes to exclude "irrelevant" data. All data is relevant I guess but this is less. * Exclude churned accounts after 3 months. * Exclude any data after 24 months. # 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. - [ ] I have checked for DRY opportunities with other models and docs. - [ ] 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: #28998
This commit is contained in:
parent
7b6fd81bf1
commit
55f8b47faa
3 changed files with 20 additions and 0 deletions
|
|
@ -75,3 +75,14 @@ left join
|
|||
int_kpis__dimension_daily_accommodation as dda
|
||||
on m.date = dda.date
|
||||
and m.dimension_value = dda.id_deal
|
||||
where
|
||||
-- Only keep data for the last 24 months
|
||||
m.first_day_month + interval '24 months' >= date_trunc('month', current_date)
|
||||
and (
|
||||
-- Display all accounts that have not churned
|
||||
hd.cancellation_date_utc is null
|
||||
-- Display historical information for accounts that have churned. This includes
|
||||
-- any data equal or prior to 3 months after the account has churned.
|
||||
or m.first_day_month
|
||||
<= date_trunc('month', hd.cancellation_date_utc) + interval '3 months'
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue