Enable answer query using Materialized View for external table. #693
Replies: 2 comments 5 replies
-
+1, we could enable this feature if users are aware what the behavior is and they could accept the risk. |
Beta Was this translation helpful? Give feedback.
-
What will you do if there are two external tables, and one has been changed but the other hasn't? Maybe we should add a per-table property, like the modification time. The user could manually set the modification time, and if the MV refresh time is later than the modification time then it could be used to answer the query. |
Beta Was this translation helpful? Give feedback.
-
Description
Currently, for inner table, planner knows to use MV to speed up query, for example:
But for external table, it doesn't work
The reason why the replacement for external doesn't work is that, if external table changes, planner doesn't know that, and replacement of MV would produce wrong results.
But for some cases, access to external table(for example, Iceberg, Hudi, and etc) is much slower than inner table(maybe 10X slower or more). If user knows there is no data changes for external table, we could speed up query against external table, which is a big win in this scenario. Another approach is that user load external table into inner table for analysis, but there is latency, and loading process is also time consuming.
How about we introduce a GUC to control the behavior? If the user is 100% sure that the external table data has not been modified, they could turn on the GUC and speed up query.
Use case/motivation
No response
Related issues
No response
Are you willing to submit a PR?
Beta Was this translation helpful? Give feedback.
All reactions