For larger queries, you can add pagination to them and get batches that can be merged together ‘off-site’. Something like:
--[params]
-- integer :limit = 10000
-- integer :page = 0
SELECT
id,
title
FROM topics
WHERE visible = false
ORDER BY id
OFFSET :page * :limit
LIMIT :limit