How to reduce execution time
I have developed a report to fetch the Beginning balance and Monthly balance based on the source & category. So I have written two SQL statements with Union clauses.
First SQL statement fetches the balance from gl_balance table quickly without any issue
Second SQL statement fetches the balance from gl_je_lines ( Need Journal & category) and it takes more than 40 minutes hence report execution fails every time. so i am looking for suggestions to reduce the execution time of the report (especially the 2nd SQL statement).
I have attached a SQL query for reference.