MySQL Forums
Forum List  »  Views

Join
Posted by: Austin Kalb
Date: April 11, 2013 04:14PM

I have 2 tables, stockOptions and stockOptionTrades. In general, for each stockOption there are many stockOptionTrades'.

1) select count(*) from todaysStockOptions; returns 147774 in .125 seconds.
2) select count(*) from todaysStockOptionTrades; returns 78538 in 0.140 seconds.

but

3) select count(*) from todaysStockOptionTrades join todaysStockOptions using (optionSymbol); returns 78538 in 86 seconds!

Simple question: Why does the joined query take so much longer? Both tables are indexed on optionSymbol. What can I do to speed this up?

Thanks
Austin

Options: ReplyQuote


Subject
Views
Written By
Posted
Join
5622
April 11, 2013 04:14PM
2352
April 11, 2013 11:41PM
2431
April 12, 2013 12:10AM
2330
April 12, 2013 10:21AM
2492
April 12, 2013 11:03AM
2346
April 15, 2013 01:05PM
2442
April 15, 2013 01:09PM
2652
April 15, 2013 03:29PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.