Can I add a hint clause to a materialized view in PostgreSQL as follows? or is there another way?
ex1.
CREATE MATERIALIZED VIEW MV1
/*+
IndexScan(tableA)
*/
SELECT...
ex2.
/*+
IndexScan(tableA)
*/
REFRESH MATERIALIZED VIEW MV1
I tried both, but ex1 didn’t work.
If possible, I’d like to do it ex1 way (include hint_plan in CREATE MATERIALIZED VIEW query).
Thanks for your help.
2
Answers
Hint clauses are not directly supported by PostgreSQL in CREATE MATERIALIZED VIEW. Usually, hints are included in the question, like:
Experimentally, the hint works when the query is run upon initial construction, but then is ignored upon refresh. Maybe this would best be addressed to pg_hint_plan’s issue tracker.