I don’t have an answer, but i’m very interested as i will have the exact same kind of exports to do.
I was wondering, do you have an SSD or a HDD ?
What is the size of the swap ?
And maybe you could split that request, by selecting only 6 hours at a time for example, that would probably avoid the swapping. But if the query takes too long (let’s say more than 1hour), you may also have an issue on RAM because you will insert points and create CSV at the same time…
Do you insert your points all at once each hour ? or is it every X minutes / seconds / … ?
I’ll let you know if i have the same problem or if i find a better solution.