Created on 06-01-2015 03:01 PM - edited 09-16-2022 02:30 AM
Created 06-19-2015 06:04 AM
Scott,
I'll refer you to the documentation on this topic here:
and
In terms of "best practice":
Use the REFRESH statement to load the latest metastore metadata and block location data for a particular table in these scenarios:
INVALIDATE METADATA and REFRESH are counterparts: INVALIDATE METADATA waits to reload the metadata when needed for a subsequent query, but reloads all the metadata for the table, which can be an expensive operation, especially for large tables with many partitions. REFRESH reloads the metadata immediately, but only loads the block location data for newly added data files, making it a less expensive operation overall. If data was altered in some more extensive way, such as being reorganized by the HDFS balancer, use INVALIDATE METADATA to avoid a performance penalty from reduced local reads. If you used Impala version 1.0, the INVALIDATE METADATA statement works just like the Impala 1.0 REFRESH statement did, while the Impala 1.1 REFRESH is optimized for the common use case of adding new data files to an existing table, thus the table name argument is now required.
Let me know if this doesn't answer your question.
Thanks
Jeff
Created 06-19-2015 06:04 AM
Scott,
I'll refer you to the documentation on this topic here:
and
In terms of "best practice":
Use the REFRESH statement to load the latest metastore metadata and block location data for a particular table in these scenarios:
INVALIDATE METADATA and REFRESH are counterparts: INVALIDATE METADATA waits to reload the metadata when needed for a subsequent query, but reloads all the metadata for the table, which can be an expensive operation, especially for large tables with many partitions. REFRESH reloads the metadata immediately, but only loads the block location data for newly added data files, making it a less expensive operation overall. If data was altered in some more extensive way, such as being reorganized by the HDFS balancer, use INVALIDATE METADATA to avoid a performance penalty from reduced local reads. If you used Impala version 1.0, the INVALIDATE METADATA statement works just like the Impala 1.0 REFRESH statement did, while the Impala 1.1 REFRESH is optimized for the common use case of adding new data files to an existing table, thus the table name argument is now required.
Let me know if this doesn't answer your question.
Thanks
Jeff
Created 02-22-2016 02:00 PM
Thanks for the great question! We have even created a Community Knowledge Article based on this thread.
Created 02-23-2016 12:31 AM
Jeff,
I understand what you explained.
However, what if HDFS rebalances data automatically?
If this scenario, it seems there is only one option left using INVALIDATE METADATA.