Hello, I've got a quite big query in our project, which works very slow if the database is big. So I'm looking for the ways to optimize it. As you can see most of nested selects are pretty similar except small details. May be it's possible to merge them or something like else? I think the biggest problem is joins in each select.
Here is the query.
Hope you can give me some advice how to optimize it. Thanks.
[upd] I'm using postgesql db, the query in plsql language looks like this
See where your hand is? Not there. It's next to this tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads