Beruflich Dokumente
Kultur Dokumente
select * from comments where rating = 5 and item_id = 99982; output: 99982;529834;725450;99982;5;"2001-10-17 22:37:53";"This is an exc" Total query runtime: 24 ms. 1 row retrieved. 5. explain select * from comments where rating = 5 and item_id = 99982; output: "Seq Scan on comments (cost=0.00..4164.00 rows=1 width=78)" " Filter: ((rating = 5) AND (item_id = 99982))" explain select * from comments where ID = 99999; output: "Index Scan using comments_pkey on comments (cost=0.00..8.29 rows=1 width=78)" " Index Cond: (id = 99999)" 6. create index comments_rating on comments(rating); output: Query returned successfully with no result in 202 ms. 7. select * from comments where ID = 99999; output: Total query runtime: 2 ms. 1 row retrieved.
Enrollment No : 499840 Name : JAGADEESWARA RAO ENNI select * from comments where rating = 5 and item_id = 99982; output: Total query runtime: 15 ms. 1 row retrieved. 8. create index comments_id on comments(item_id); output: Query returned successfully with no result in 182 ms. select * from comments where ID = 99999; output: 99999;778249;862311;99999;3;"2001-10-17 22:37:59";"This is a comment above average. You can trust this seller even " Total query runtime: 13 ms. 1 row retrieved. select * from comments where rating = 5 and item_id = 99982; output: Total query runtime: 12 ms. 1 row retrieved. 9. explain select * from comments where rating = 5; output: "Bitmap Heap Scan on comments (cost=330.38..3242.97 rows=19887 width=78)" " Recheck Cond: (rating = 5)" " -> Bitmap Index Scan on comments_rating (cost=0.00..325.41 rows=19887 width=0)" " Index Cond: (rating = 5)"
explain select * from comments where rating = 5 and comment = 'Q' output: "Bitmap Heap Scan on comments (cost=325.42..3287.73 rows=53 width=78)"
Enrollment No : 499840 Name : JAGADEESWARA RAO ENNI " Recheck Cond: (rating = 5)" " Filter: (comment = 'Q'::text)" " -> Bitmap Index Scan on comments_rating (cost=0.00..325.41 rows=19887 width=0)" " Index Cond: (rating = 5)"
1. drop the tables in university Schema. 2. inserte( rows) into the university Schema table 3. Run the following Queries 1. select * from takes natural join student; output: Total query runtime: 3012 ms. 30000 rows retrieved. 2. select * from takes natural join student where ID = '1234'; output: Total query runtime: 2 ms. 0 rows retrieved. 3.select ID, count(*) from takes group by ID; output: Total query runtime: 72 ms. 2000 rows retrieved. 4. select * from student, instructor where student.id = instructor.id and student.id = '1234' output: Total query runtime: 12 ms.
Enrollment No : 499840 Name : JAGADEESWARA RAO ENNI 0 rows retrieved. 5. select * from student, instructor where upper(student.id) = upper(instructor.id) and student.id = '1234' output: Total query runtime: 12 ms. 0 rows retrieved.