Quote:
How to optimize very long SQL script (all the scripting good practices has been done)
The problem is that you gave us exactly the right mix of told and untold information so that we can't give you useful tips.
Possibles solutions depend on:
- Database structure, tables and indexes
- size of tables
- rate of database changes (inserts, updates, deletes)
- meaning of database
- meaning of report
- The 4000 lines script itself
A solution will depend on all this and probably access to your database.
This is a job for database designer.