Q5

0

Please login or register to vote for this query.

(click on this box to dismiss)

Computational Science

Q&A for scientists using computers to solve scientific problems

-- 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;

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results