Q&A for anime and manga fans
-- Step 1: Use pagination to process a small number of records at a time SELECT TOP 10 -- Start with a very small batch size Tags, (LEN(Tags) - LEN(REPLACE(Tags, ',', ''))) + 1 AS NumberOfTags, -- Calculate the number of tags Id AS PostId, OwnerUserId AS UserId, LEFT(Body, 50) AS PostBody -- Truncate Body to a very small length for optimization FROM Posts WHERE Tags IS NOT NULL AND Tags LIKE '%,%,%,%,%' -- Filter for at least 4 commas, indicating 5 or more tags AND LEN(Tags) - LEN(REPLACE(Tags, ',', '')) + 1 >= 5 -- Double-check for 5+ tags AND Id BETWEEN 1 AND 10000 -- Process a narrow range of IDs in each batch ORDER BY Id ASC;