create table foo ( x int not null, y int not null, primary key (x));I then loaded in a file containing 10,000 rows of data. The x values were the integers from 1 to 10,000 and the y value in each row was the same as that row's x value. The query
select * from foo where x = 1;took 0.00 seconds to execute, whereas
select * from foo where y = 1;took 0.01 seconds. Increasing the number of rows to 100,000 left the first time 0.00 seconds, but increased the second to 0.10. When I tried changing the selection criteria to use a different number in place of 1 (such as looking for x = 100000, or looking for y = 100000), this didn't change the times appreciably. Explain these observations.
explain select * from movies m, acts_in a, persons p where m.id = a.movie and p.id = a.actor and p.fnames = 'Orson' and m.year_made < 1990;to get an execution plan. Using the MySQL documentation, translate the execution plan into English. Without adding any indexes, how else might the query reasonably be executed? Do you agree with MySQL's choice?
Instructor: Max Hailperin