We run an OPTIMIZE table_name FINAL after loading, but we still see numerous duplicates even after the OPTIMIZE command appears to have finished. This is because it runs silently and doesn’t return any information or errors.
Because OPTIMIZE table_name FINAL
might not do anything. The default value is 0, and this parameter is dynamic.
Applying this option allows you to distinguish between these scenarios and receive the reason in an error message. Here is the command:
SET optimize_throw_if_noop=1