Background:
I currently have two tables, orders and payments. I need to track payments in their own table for accounting purposes. I was keeping a running tally of the balance in the orders table and updating it whenever a payment was made (I also set a paid date when the balance reached 0) but ran into a row locking issue when someone made a payment that covered 2 orders that were next to each other in the orders table if the orders form was open. So... I took the balance and paid date out and created functions to calculate them and display the calculation on the orders form now.
The problem is, I also have a past-due report to find orders that are more than 60 days old. What used to take a couple seconds to generate is now taking 30+ seconds for only 2500 orders because I have to calculate the balance for every order to see if its is 0. I have the primary, foreign, and where fields indexed for the query. Any recommendations on what I can do to get some of the speed back so as the orders continues to grow it doesn't turn into a day-long thing to generate?
Thanks, Lution
I currently have two tables, orders and payments. I need to track payments in their own table for accounting purposes. I was keeping a running tally of the balance in the orders table and updating it whenever a payment was made (I also set a paid date when the balance reached 0) but ran into a row locking issue when someone made a payment that covered 2 orders that were next to each other in the orders table if the orders form was open. So... I took the balance and paid date out and created functions to calculate them and display the calculation on the orders form now.
The problem is, I also have a past-due report to find orders that are more than 60 days old. What used to take a couple seconds to generate is now taking 30+ seconds for only 2500 orders because I have to calculate the balance for every order to see if its is 0. I have the primary, foreign, and where fields indexed for the query. Any recommendations on what I can do to get some of the speed back so as the orders continues to grow it doesn't turn into a day-long thing to generate?
Thanks, Lution