Chapter 12 Exercise 10

10. Copy the City table and remove all of the indexes from the copy. Create a query that counts the number of customers from each state using the original City table. Create a second copy of the query that uses the copy of the City table. Run both queries and comment on the performance of the two queries.

New table: Copy of City
SELECT City.State, Count(Customer.CustomerID) AS CountOfCustomerID
FROM City INNER JOIN Customer ON City.CityID = Customer.CityID
GROUP BY City.State;

SELECT [Copy Of City].State, Count(Customer.CustomerID) AS CountOfCustomerID
FROM [Copy Of City] INNER JOIN Customer ON [Copy Of City].CityID = Customer.CityID
GROUP BY [Copy Of City].State;

With only 100 customers and less than 6,000 cities, there is no measurable difference in performance. With a slow machine, with minimal RAM, you might see a difference. If you get to one million customers, you might see a difference. The point of this question is to show that even at several thousand rows, performance is reasonable even without indexes.