How to change the response default_limit in data explorer?

You can change a hidden site setting using the rails console (if you have server access).

cd /var/discourse
./launcher enter app
rails c
SiteSetting.data_explorer_query_result_limit = 10000

Though the upper limit is 10,000, and I believe this is only the number of results that are displayed ‘on-screen’ - you can already export 10,000 results even with the setting at the default 1000.

I think adding a page offset to your query is useful if you want to grab batches to export and join together in a spreadsheet (etc). eg:

-- [params]
-- integer :page = 0
-- integer :limit = 10000

SELECT 
    category_id,
    created_at::date,
    id AS topic_id,
    views
FROM topics
WHERE deleted_at IS NULL
ORDER BY created_at DESC
OFFSET :page * :limit
LIMIT :limit