From 485486c7ff986712ecb09e92217236d276d317c4 Mon Sep 17 00:00:00 2001
From: Claude <noreply@anthropic.com>
Date: Mon, 12 Jan 2026 08:46:55 +0000
Subject: feat: deduplicate feed items by guid

Use ROW_NUMBER() window function to filter out duplicate articles
with the same guid across different feeds. This ensures each guid
appears only once in unread/read article lists.

- Add idx_articles_guid index for PARTITION BY performance
- Modify GetUnreadArticles and GetReadArticles queries with CTE
---
 backend/db/schema.sql | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'backend/db/schema.sql')

diff --git a/backend/db/schema.sql b/backend/db/schema.sql
index adf3b37..07ac72d 100644
--- a/backend/db/schema.sql
+++ b/backend/db/schema.sql
@@ -34,4 +34,6 @@ CREATE INDEX IF NOT EXISTS idx_articles_feed_guid ON articles(feed_id, guid);
 
 CREATE INDEX IF NOT EXISTS idx_articles_is_read ON articles(is_read);
 
+CREATE INDEX IF NOT EXISTS idx_articles_guid ON articles(guid);
+
 CREATE INDEX IF NOT EXISTS idx_feeds_user_id ON feeds(user_id);
-- 
cgit v1.2.3-70-g09d2

