Skip to content

Commit b1ff80e

Browse files
adding indexed created_at column to lineage events table (#2299)
* adding indexed created_at column to lineage events table Signed-off-by: Prachi Mishra <prachi.mishra@astronomer.io> * populate default values in lineage_events.created_at column Signed-off-by: Prachi Mishra <prachi.mishra@astronomer.io> * removing backfill step Signed-off-by: Prachi Mishra <prachi.mishra@astronomer.io> * altering type to TIMESTAMP WITH TIME ZONE Signed-off-by: Prachi Mishra <prachi.mishra@astronomer.io> * adding NULLS LAST in desc index on lineage_events.created_at Signed-off-by: Prachi Mishra <prachi.mishra@astronomer.io> Signed-off-by: Prachi Mishra <prachi.mishra@astronomer.io>
1 parent e501e36 commit b1ff80e

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
-- new column will be created with 'null' filled for existing rows
2+
ALTER TABLE lineage_events ADD created_at TIMESTAMP WITH TIME ZONE;
3+
4+
create index lineage_events_created_at_index on lineage_events (created_at desc NULLS LAST);
5+
6+
-- The new default set to UTC now() will only apply in subsequent INSERT or UPDATE commands; it does not cause rows already in the table to change.
7+
ALTER TABLE lineage_events ALTER COLUMN created_at SET DEFAULT (now() AT TIME ZONE 'UTC')::timestamptz;

0 commit comments

Comments
 (0)