I tend to use temporary tables a lot, because I'm doing one-off
manipulations where efficiency is not the primary concern and because it
helps me think things through. Nonetheless, I've been wondering about this:

 

SELECT `x` FROM `t1` JOIN (SELECT `x` FROM `t2`) AS `t3` on `t1`.`y` =
`t3`.`y`;

 

Table `t3` won't have any indices, even if table `t2` does, is that correct?
(Assume that the sub-select is really much more complicated that my
example.) Wouldn't it be a lot faster to replace the sub-select with a
temporary table that does have a key on `y`?

 

Regards,

 

Jerry Schwartz

The Infoshop by Global Information Incorporated

195 Farmington Ave.

Farmington, CT 06032

 

860.674.8796 / FAX: 860.674.8341

 

 <http://www.the-infoshop.com> www.the-infoshop.com

 <http://www.giiexpress.com> www.giiexpress.com

www.etudes-marche.com

 

Reply via email to