Homework #4 FAQ

Question: In Problem 1, some of those things are not ``updates,'' especially part (c).
Answer: Sorry-- the proper term is ``modifications,'' which include inserts, deletes, and true updates. Also, part (c) involves a table creation, but then requires some modification.

Question: What does 15 pts. have to do with part 1 of the PDA?
Answer: Sorry again. That was an artifact of the old grading system. We'll grade this PDA on a 1-10 scale as always.

Question: I'm having trouble interpreting ... (some question, usually #5)
Answer: The questions look meaningful to the instructor, and in each case the proper interpretation is simpler than the various interpretations that have appeared in messages to cs145-help. If you really can't come up with a simple, sensible interpretation, you are welcome to discuss the matter in office hours.

Question: Do we have to come up with the most efficient solution to an SQL problem.
Answer: No. In fact, the running time of your query is the responsibility of the DBMS, and a good DBMS will run all equivalent queries in the same way. The purpose of using a very high-level language like SQL as the query language is to save programmers the trouble of doing their own optimization. Rather, you should write queries in the manner that is most convenient for you.

Question: I created indexes and they only slow down the query.
Answer: That could happen for several reasons.

  1. A complex query, one involving several relations, is only helped if there are suitable indexes that support all the selections and joins involved in the query. Creating one or a few indexes, but less than what you need for the query may not help, and may even slow it down because you are retrieving index pages as well as data pages from disk.

  2. People who run with the index(es), drop them, and then rerun, may find that the data pages are still in main memory, and therefore they save (on the second run) all the disk accesses that they did on the first run. That, ironically, makes it look like indexes are a major time-sink, rather than a speedup. The fix for this problem is to run once say without the index(es), exit sqlplus, wait a short time, and then run again with the indexes. Alternatively, run your queries on two different machines.