lives (name, street, city) works (name, company, salary) located (company, city) manages (name, manager-name)You may make the following assumptions for this problem:
(1) | plain |
select Alist from Rlist where cond (cond contains no subqueries) (2) | in |
select Alist from Rlist1 | where cond1 and A1 in (select A2 from Rlist2 where cond2) (3) | not in |
select Alist from Rlist1 | where cond1 and A1 not in (select A2 from Rlist2 where cond2) (4) | exists |
select Alist from Rlist1 | where cond1 and exists (select * from Rlist2 where cond2) (5) | not exists |
select Alist from Rlist1 | where cond1 and not exists (select * from Rlist2 where cond2) (6) | = all |
select Alist from Rlist1 | where cond1 and A1 = all (select A2 from Rlist2 where cond2) (7) | not = all |
select Alist from Rlist1 | where cond1 and not A1 = all (select A2 from Rlist2 where cond2) (8) | <> all |
select Alist from Rlist1 | where cond1 and A1 <> all (select A2 from Rlist2 where cond2) (9) | not <> all |
select Alist from Rlist1 | where cond1 and not A1 <> all (select A2 from Rlist2 where cond2) (10) | < all |
select Alist from Rlist1 | where cond1 and A1 < all (select A2 from Rlist2 where cond2) (11) | not < all |
select Alist from Rlist1 | where cond1 and not A1 < all (select A2 from Rlist2 where cond2) (12) | <= all |
select Alist from Rlist1 | where cond1 and A1 <= all (select A2 from Rlist2 where cond2) (13) | not <= all |
select Alist from Rlist1 | where cond1 and not A1 <= all (select A2 from Rlist2 where cond2) (14) | > all |
select Alist from Rlist1 | where cond1 and A1 > all (select A2 from Rlist2 where cond2) (15) | not > all |
select Alist from Rlist1 | where cond1 and not A1 > all (select A2 from Rlist2 where cond2) (16) | >= all |
select Alist from Rlist1 | where cond1 and A1 >= all (select A2 from Rlist2 where cond2) (17) | not >= all |
select Alist from Rlist1 | where cond1 and not A1 >= all (select A2 from Rlist2 where cond2) (18) | = any |
select Alist from Rlist1 | where cond1 and A1 = any (select A2 from Rlist2 where cond2) (19) | not = any |
select Alist from Rlist1 | where cond1 and not A1 = any (select A2 from Rlist2 where cond2) (20) | <> any |
select Alist from Rlist1 | where cond1 and A1 <> any (select A2 from Rlist2 where cond2) (21) | not <> any |
select Alist from Rlist1 | where cond1 and not A1 <> any (select A2 from Rlist2 where cond2) (22) | < any |
select Alist from Rlist1 | where cond1 and A1 < any (select A2 from Rlist2 where cond2) (23) | not < any |
select Alist from Rlist1 | where cond1 and not A1 < any (select A2 from Rlist2 where cond2) (24) | <= any |
select Alist from Rlist1 | where cond1 and A1 <= any (select A2 from Rlist2 where cond2) (25) | not <= any |
select Alist from Rlist1 | where cond1 and not A1 <= any (select A2 from Rlist2 where cond2) (26) | > any |
select Alist from Rlist1 | where cond1 and A1 > any (select A2 from Rlist2 where cond2) (27) | not > any |
select Alist from Rlist1 | where cond1 and not A1 > any (select A2 from Rlist2 where cond2) (28) | >= any | <
select Alist from Rlist1 | where cond1 and A1 >= any (select A2 from Rlist2 where cond2) (29) | not >= any |
select Alist from Rlist1 | where cond1 and not A1 >= any (select A2 from Rlist2 where cond2) |
Now here's the problem:
This week you will have the pleasure of running queries over the data in your PDA.
There are a number of important things to keep in mind:
create index index-name on relation-name (attribute-name)
If you know that the attribute is a key, you can speed things up even more by declaring the index as follows:
create unique index index-name on relation-name (attribute-name)
You can get rid of an index using the command:
drop index index-name K
Indexes can be created on lists of attributes as well as on single attributes. Create at least two useful indexes for your PDA. Run your queries from part (a) on your large database with the indexes and without the indexes. Note that each time you run an SQL command in Sybase, afterwards you get statistics about how long it took to execute the command. Naturally these times may be affected by external factors such as system load, etc. Still, you should see a dramatic difference between the execution times with indexes and the times without. Turn in a script showing your commands to create indexes, and showing the relative times of query execution with and without indexes.