• Honestly from what you described the time sounds about as good as it is going to get. Assuming roughly 50% of your rows are "ON" then you are selecting about 5 million rows with 50 columns. 7 1/2 minutes sounds about like what I would expect. Why all columns and what in the world are you doing with 5 million rows?

    Why all columns?

    The SQL statement in question is from a "batch" process that runs against our database during the day, a few times a day, it's a vendor package that runs this statement. We're trying to get the vendor to change this query to only select the columns needed. That on its own it has been a good argument and challenge.

    Why 5 millions rows?

    It's all the transaction history that we have in our accounting system. After the selection, depending on the results return, there's another set of events that are happening afterwards.