User bio
404 bio not found
Member since May 12, 2017
Replies:

You are correct, it is more WHERE conditions.  In the original query I did have those values as more WHERE, but I am attempting to speed up the processing.

I started looking at the data, and found the query was doing A LOT of process/retrieving of data that was later thrown on the floor.  If I could make the query use the Account.Type first, I would eliminate extra time joining other (large) tables.

You are correct, that where clause is not exactly right (as this is not my real SQL, but a representation of what I was doing)

 

Should've been:

select Account.Name, Account.State, Transaction.Amt, Transaction.Date, Transaction.Service
from Transaction 
left join Account 
    on Account.Id = Transaction.Account  
where Transaction.Account in (
    Select Account.Id

     from Account
     where Account.Type is not null
     and Account.Id>123456789
     and Account.Id<=323456789
)
and Transaction.Date >= ?
and Transaction.Date <= ?

Certifications & Credly badges:
P has no Certifications & Credly badges yet.
Global Masters badges:
P has no Global Masters badges yet.
Followers:
P has no followers yet.
Following:
P has not followed anybody yet.