There are 10K records to export using complex query using postgres, this query has OR condition per record. Running query with multiple or condition like ~700, gives ERROR: temporary file size exceeds temp_file_limit However 500 records works fine, I used Export From Query option from dbeaver and it works fine, for 500 OR conditions query. But I have to each time run new set of query with 500 OR condition, is there a way I run my entire query with 10K condition in one go, and dbeaver autogenerate the files for each 500 condition in specified folder. So I have to execute it only once, and since it will generate files for each 500 records, it will not give the file size error, and I can collect all the exported files with the result. I can do it manually, but its taking time, wondering if there is any automated way to generate files with 500 records
Example query :
select t.id, t.timestamp --etc
from
schema1.result p
inner join schema1.t t on (t.result_id = p.id)
-- multiple inner joins here
where
and p.value like 'rarararar%'
or p.value like 'babaaba%'
or p.value like 'blahblah%'
-- here it has thousands of or conditions