I have a table which may contain around 3 million data, I need query to fetch around 300k data with status 'inactive' say all regions having 30k data and export into csv file.
select Id, Name, region, status, creationdate
from Organization
where status = 'inactive'
group by region
having count = 30000
order by creationdate desc;
Does this query fetch the latest data in all regions or need to be fine tuned?