Split up overpass turbo request


I have encountered a problem with requesting a lot of data from specific time points. I am collecting data for the number of supermarkets in each region in Germany, for the last 6 years. I’ve done this for gas stations already, and it worked fine, requesting each year at once. For supermarkets only 2022 worked, for the other years the number of requests is too high and the request cancels.

[out:csv( "ref:nuts:3", name, total, nodes, ways, relations )][date:"2022-07-01T00:00:00Z"][timeout:9000];

//All NUTS 3 regions in Germany

// Count the supermarkets in each area
  // Collect all Nodes, Ways and Relations wth amenity=supermarket in the current area
  ( node(area.regio)[shop=supermarket];
  make count "ref:nuts:3" = regio.set(t[ "ref:nuts:3"]),
             name = regio.set(t["name"]),
             total = count(nodes) + count(ways) + count(relations),
             nodes = count(nodes),
             ways = count(ways),
             relations = count(relations);

I’m only switching the date on top of the code.

Is there any way to split up the request into two? Or anything else I can do?

I assume you already tried separating node , way , and rel, instead of the nwr union here? Unfortunately, I believe it is not possible to determine whether a retrieved element is inside a retrieved area, without retrieving them repeatedly by (area.regio) yet. If I’m understanding correctly, there is an open ticket for it from years ago. [perf] Points in polygon - JOINING inputsets · Issue #444 · drolbr/Overpass-API · GitHub
You can do a spatial join in other GIS software easily on all the [shop=supermarket] for what region they are in. Then it’s simple database / form / spreadsheet filtering to get a count.
If you insist on doing in Overpass alone, the “best” method might be to write a script to query for each region, if not also the object type; and automate the year changing together. It is not feasible to do this manually for 401 regions, and 6 years.