Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM SQL » View Thread |
Messages 1 to 3 of 3 total |
Which is Faster? |
Wed, Dec 12 2007 10:58 AM | Permanent Link |
"B Miller" | I have a table of Accounts that I get a selection from:
Select * into \memory\tempAcct from Account where ........ Now I need the corresponding transactions for all of them, not one account at a time. So which method would generally produce the fastest result? A: select * from Transactions where AccountID in (select AccountID from \memory\tempAcct) or B. select T.* from \memory\tempAcct A left outer join Transactions T on A.AccountID=T.AccountID Or, are there other considerations? TIA, Bill |
Wed, Dec 12 2007 11:42 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Bill
My bet would be on the join, but the best way is to suck it and see - do it in DBSys, produce the plan for each version and just have a look Roy Lambert |
Wed, Dec 12 2007 12:05 PM | Permanent Link |
"Robert" | "B Miller" <bmiller@nospam.com> wrote in message news:8045C6E6-F3FE-45E4-B4E7-84B18FB06C07@news.elevatesoft.com... >I have a table of Accounts that I get a selection from: > Select * > into \memory\tempAcct > from Account where ........ > > Now I need the corresponding transactions for all of them, not one account > at a time. > So which method would generally produce the fastest result? > A: > select * from Transactions where AccountID in (select AccountID from > \memory\tempAcct) > > or B. > select T.* > from \memory\tempAcct A > left outer join Transactions T on A.AccountID=T.AccountID > It depends on the size of the first selection. My choice would be B, since it would work OK regardless of size. I would strongly recommend creating an index on the memory table account ID. > Or, are there other considerations? Well, the obvious question is why go thru the create memory table in the first place? You could just join the accounts table to the transactions table, and have the where clause as part of the single query. Eliminate the middleman. Robert |
This web page was last updated on Saturday, May 4, 2024 at 12:54 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |