Rethink the indices and planner cost optimizations in light of the current usage patterns
When the Mentat was migrated to PotgreSQL, the DB was version 9.6. The current version is v12, with v13 nearing. Tremendous amount of work was done upstream in the database, many of the premises valid then are no longer true. Also, the capabilities of Mentat grew in ways not foreseen or at least not originally intended (thanks to CTI).
We need to go back to drawing board, analyze the analytics processing needs of current Mentat, the processing capabilities of current PostgreSQL, and come up with a new database configuration and indexing schema, addressing the new requirements.