The visits table holds one row for each page that a user opened: 100 000 rows. The support page looks up all the visits of one user, and it is slow.
The query is: SELECT * FROM visits WHERE user_id = 4242
- Show the plan of that query. Do not run the query itself.
- Which kind of scan does the plan use?
- What is the total cost of the plan? Give the number after the two dots.
- Run the query with
EXPLAIN ANALYZE. How many rows did the scan read and throw away?