Базы данных
Оптимизация запросов
select LastName from Students natural join Groups where Name = 'M34391'
check not HasScolarship or 60 <= all (select Points from Points where Points.SId = Id)
select Points from Students natural join Points where HasScolarship and CId = 10 and GId = M34391
select * from Students natural join Points natural join Courses
select * from Students natural join Points natural join Courses natural join Lecturers
select FirstName, Name from Students natural join Groups where AveragePoints > 4.8 and Program = 5
Таблица | Порядок | Описание |
---|---|---|
Students | – | Полный просмотр |
Students | GId | Просмотр GId |
Students | GId | Поиск по GId |
Students | – | Поиск по APoints |
Groups | GId | Полный просмотр |
Groups | GId | Поиск по GId |
Groups | – | Поиск по Program |
Таблица | Порядок | Описание | Стоимость |
---|---|---|---|
Students | – | Полный просмотр | $1000$ |
Students | GId | Просмотр GId | $10^4$ |
Students | GId | Поиск по GId | $23$ / GId |
Students | – | Поиск по APoints | $96$ |
Groups | GId | Полный просмотр | $20$ |
Groups | GId | Поиск по GId | $2$ / GId |
Groups | – | Поиск по Program | $5$ |
Прав \ лев | S.GId | S.AP | G.GId | G.Prog |
---|---|---|---|---|
Просмотр S.GId | merge | loops | ||
Поиск по S.GId | index | index | ||
Поиск по S.AP | loops | hash | ||
Просмотр G.GId | merge | loops | ||
Поиск по G.GId | index | index | ||
Поиск по G.Prog | loops | hash |
Метод | Стоимость |
---|---|
S.GId merge G.GId | $10^4$ |
S.AP index G.GId | $276$ |
S.AP hash G.Prog | $111$ |
G.Prog index S.GId | $97$ |
select FirstName, Name from Students natural join Groups where AveragePoints > 4.8 and Program = 5 order by Students.GId