Continued to analyze all the queries used in the extraction for the optimization and might be changing some of the approaches made on it, the query has many inserts while selecting queries and after this there are updates. Backup and Restore the database on my local for testing the query to a test database and for testing the changes. This optimization is needed as the processing of the files is too late, as of now they're in July 2022.