Skip to content

Commit

Permalink
MMI-244 Create index on content table (#2376)
Browse files Browse the repository at this point in the history
* MMI-244 Create index on content table

- created index on status field and published on field
- added index to content configuration
  • Loading branch information
laidaoyu authored Jan 1, 2025
1 parent c491b57 commit 2483552
Show file tree
Hide file tree
Showing 5 changed files with 7,532 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libs/net/dal/Configuration/ContentConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ public override void Configure(EntityTypeBuilder<Content> builder)
builder.HasIndex(m => new { m.ContentType, m.OtherSource, m.Uid, m.Page, m.Status, m.IsHidden }, "IX_content");
builder.HasIndex(m => new { m.Edition, m.Section, m.Byline }, "IX_print_content");
builder.HasIndex(m => m.Headline, "IX_headline");
builder.HasIndex(m => m.PublishedOn, "IX_content_published_on");
builder.HasIndex(m => m.Status, "IX_content_status");

base.Configure(builder);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
DO $$
BEGIN

DROP INDEX IF EXISTS public."IX_content_published_on";
DROP INDEX IF EXISTS public."IX_content_status";

END $$;
11 changes: 11 additions & 0 deletions libs/net/dal/Migrations/1.3.15/Up/PostUp/00-CbraCreateIndex.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
DO $$
BEGIN

CREATE INDEX IF NOT EXISTS "IX_content_published_on"
ON public.content USING btree
(published_on DESC);
CREATE INDEX IF NOT EXISTS "IX_content_status"
ON public.content USING btree
(status ASC);

END $$;
Loading

0 comments on commit 2483552

Please sign in to comment.