Where does that query come from?

My Magento 1.9 The store is sometimes very slow. I noticed that this is due to a long-term query. I saw that the next query runs for about 30 seconds and it activates a lot.

Any idea what part could start that query? I need to find out why and when it is activated and avoid it if possible.

Query: https://pastebin.com/LEQ8MWhv

Thank you!