Skip to content
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

chore: redo and clean all indexes on attributes instances tables #1222

Merged
merged 1 commit into from
Aug 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
-- Default indexes created by Timescale that should not have been removed
-- https://docs.timescale.com/use-timescale/latest/hypertables/about-hypertables/#hypertable-indexes
CREATE INDEX IF NOT EXISTS attribute_instance_time_idx
ON attribute_instance(time DESC );
CREATE INDEX IF NOT EXISTS attribute_instance_audit_time_idx
ON attribute_instance_audit(time DESC);

-- Indexes on main keys used when doing a temporal query
-- As recommended in https://docs.timescale.com/getting-started/latest/create-hypertable/#creating-your-first-hypertable
CREATE INDEX attribute_instance_tea_idx
ON attribute_instance(temporal_entity_attribute, time DESC);
CREATE INDEX attribute_instance_audit_tea_timeproperty_idx
ON attribute_instance_audit(temporal_entity_attribute, time_property, time DESC);

-- Remove current unwanted indexes
DROP INDEX IF EXISTS attribute_instance_audit_tea_time_property_idx;
DROP INDEX IF EXISTS attribute_instance_temporal_entity_attribute_idx;

-- Same as attribute_instance_time_idx created above, but with a deprecated reference to observed_at column
DROP INDEX IF EXISTS attribute_instance_observed_at_idx;
Loading