Re: Very newbie question - Mailing list pgsql-general

From Francisco Olarte
Subject Re: Very newbie question
Date
Msg-id CA+bJJbwWE09opeVAo5-imbbPHvcnAPcf33x-07XPJv7RDq+oYA@mail.gmail.com
Whole thread Raw
In response to Re: Very newbie question  (Олег Самойлов <splarv@ya.ru>)
List pgsql-general
On Mon, 23 Oct 2023 at 17:42, Олег Самойлов <splarv@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
moreelegant 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.



pgsql-general by date:

Previous
From: Achilleas Mantzios
Date:
Subject: Re: PostgreSQL inheritance vs https://wiki.postgresql.org/wiki/Don%27t_Do_This
Next
From: Merlin Moncure
Date:
Subject: psql _ and \e -- what does clearing the query buffer actually do?