optimize query

Hi, I need some advice regarding this query.

https://tools.percona.com/query/PTsWIJSJ/advice

I’ve already optimized my MySQL server configuration usually it takes around 300-380 seconds to finish, after optimization it now just takes around 100-120 seconds.

Querying happens from a remote server but on a local network.

Thanks,

This is really complex query, joining many tables with some sub-selects. Definitely it’s not OLTP type, so don’t expect it to finish in less then second :slight_smile:
Provide EXPLAIN plan and all related tables definitions, maybe there are some index opportunities to make it faster.