In these lab exercises, we will be using imdbLarge, a fuller version of the movies database based on a subset of the Internet Movies Database (IMDB). Because of its size, this database must be loaded using Oracle Datapump files. See the following readme file for details on how to do this.

C:\projects\cs342\cs342-resources\web\resources\databases\imdbLarge\readme.txt
The schema is similar, but not identical to the imdb database we’ve used before; see the schema.sql for details.

When tuning SQL code, use the following tools (see the class code in cs342/code/09programming for examples of how to use them).

With this rather large database in place and these helpful tools, do the following exercises.

Exercise 9.1

Build sample queries to test that:

  1. there is a benefit to using either COUNT(1) , COUNT(*) or SUM(1) for simple counting queries.

  2. the order of the tables listed in the FROM clause affects the way Oracle executes a join query.

  3. the use of arithmetic expressions in join conditions (e.g., FROM Table1 JOIN Table2 ON Table1.id+0=Table2.id+0 ) affects a query’s efficiency.

  4. running the same query more than once affects its performance.

  5. adding a concatenated index on a join table improves performance (see the create index command described above).

Store your test queries along with your conclusions and explanations in lab09_1.sql . Be sure to experiment with different variations of each exercise and pay particular attention to the EXPLAIN-PLAN operations listed in the reading guide.

Don Burleson offers some useful Oracle tuning tips at Oracle SQL tuning, though his heuristics don’t always work out on the IMDBlarge.

Checking in

We will grade your work according to the following criteria: