Optimize logstash configuration

Hello. Thanks for the reply. If I understand you correctly...

Should I configure the statement to get only the changed ones(after fetch the entire table once and then)?

I'll ask you one more thing.
How can sql_last_value be given a value?

Can you elaborate on the last_run_metadata_path and sql_last_value parts in more detail? I don't know how to set sql_last_value