On Mon, 23 Oct 2023 at 17:42, Олег Самойлов <spl...@ya.ru> wrote: > Well, get list of partitions and later scan one by one all 100 partitions is > too simple. :) I am interesting is here more elegant way? Any rewriting the > query, any creating an index are permitted.
1.- You do not scan all partitions. Had you not top-posted it coudl easily be noted: > > 1.- Get list of partitions, sort oldest first. This means you get list of partitions, which is just a query, sorting them, even if you have to do it client side should be trivial unless you use really weird schemes, and you could sort them by your ranges in the query. Also, getting them oldest first means you evaluate the age-query before archiving, once for each archivable partition plus one extra, an overhead which should be dwarfed by any non-trivial archival, even a rename or drop index would probably be longer. And last. We have different concepts for elegance. IMO by saying a solution is "too simple" not having stated "I want a complex tricky solution" disqualifies you a bit. For real problems, no solution is too simple ( it may be a language problem, or you may have hidden constraints, but that needs to be specified ). feel free to exec &> /dev/null. Francisco Olarte.