As a quick question. Can Postgres make use of indexes on a table when the data from that table is being returned from a procedure?
Some more details. I have a big table which has a long running query running on it. This table gets rebuilt from scratch on a weekly basis. Currently, I cannot update/replace the table in a timely manner, I have to wait for the long running queries to finish before we can update the table (the total time can be 5+ hours).
I am currently trying to build a procedure which will return data from the latest version of the table (by dynamically choosing the table name, something like