-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Year-Based Partitioning for Notification Table #95
Labels
Dev Reviewed
Reviewed by Tech Lead
Notify
Board trigger
PM Reviewed
Reviewed by Product Manager
QA Reviewed
Reviewed by Quality Assurance
QA
Issue requires QA collaboration
Comments
MackHalliday
changed the title
Implement Year-Based Partitioning for Notification Table in ENP
Implement Year-Based Partitioning for Notification Table
Dec 10, 2024
MackHalliday
changed the title
Implement Year-Based Partitioning for Notification Table
DRAFT Implement Year-Based Partitioning for Notification Table
Dec 10, 2024
MackHalliday
changed the title
DRAFT Implement Year-Based Partitioning for Notification Table
Implement Year-Based Partitioning for Notification Table
Dec 10, 2024
MackHalliday
changed the title
Implement Year-Based Partitioning for Notification Table
Implement Year-Based Partitioning for Notification Table
Dec 10, 2024
question for ya @MackHalliday CREATE TABLE IF NOT EXISTS notifications_2024 PARTITION OF notifications
FOR VALUES FROM ('2024-01-01') TO ('2025-01-01');
CREATE TABLE IF NOT EXISTS notifications_2025 PARTITION OF notifications
FOR VALUES FROM ('2025-01-01') TO ('2026-01-01'); Should it go from '2024-01-01' to '2024-01-31' instead of '2025-01-01'? |
As I understood the documentation - those queries read like this
Where
|
Great! thank you @MackHalliday |
15 tasks
Today
Tomorrow
|
TODO
|
Tuesday
Today
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Dev Reviewed
Reviewed by Tech Lead
Notify
Board trigger
PM Reviewed
Reviewed by Product Manager
QA Reviewed
Reviewed by Quality Assurance
QA
Issue requires QA collaboration
User Story - Business Need
We’re partitioning the Notification table by year to improve performance and scalability as the table grows. By splitting the data into smaller, year-based partitions using the
created_at
column, we can make queries targeting specific time ranges much faster and more efficient. It also makes managing and archiving data simpler in the long run. This change is a proactive step to ensure the system stays performant as the database continues to scale.This ticket assumes that the ENP application has access to a test database and supports running migrations.
User Story(ies)
As a VANotify developer maintaining the ENP PostgresSQL database
I want to partition the Notification table by year
So that we can improve query performance, scalability, and manageability of the data as it grows over time.
Additional Info and Resources
RANGE
on thecreated_at
column.PARTITION BY RANGE (created_at)
.notifications_2024
andnotifications_2025
.created_at
condition to leverage partitioning.Acceptance Criteria
created_at
column.created_at
value.created_at
condition only scan relevant partitions.Note on Removed AC
This ticket was created assuming we would have migration working. We decided to implement this before the migrations. Therefore - the ACs related to migrations were removed.
Migration scripts are created and successfully tested to implement partitioning without downtime.Downgrade migration can be successfully executed to revert the partitioning changes without data loss or corruption.Note on Removed AC
We do not have a database setup for unit tests - therefore, this cannot be tested via unit tests. I talked to @k-macmillan and we determined this will be tested thru the test endpoints for the database instead.
Unit tests are implemented and demonstrate that queries correctly retrieve data from the partitioned table structure.Unit tests demonstrate queries can handle date ranges across multiple yearsQA Considerations
created_at
values go to the correct partition.POST /v2/notifications/push
created_at
filters to confirm correct behavior. (If not deployed, confirmed write tests OK or any existing endpoints using filtering OK. At the time of writing this ticket, there appear to be no endpoints that filter Notifications)Potential Dependencies
The text was updated successfully, but these errors were encountered: