by wiredfool · 14y ago · 0 comments
-> Seq Scan on movie_person (cost=0.00..10117.01 rows=97 width=8)
(actual time=2.540..59.933 rows=9 loops=1)
Filter: (person_id = 160)
If he had an index on movie_person, that would be a ~ 1ms index lookup, not a table scan. You can't do that sort of database layout without putting indexes on the M2M mapping table.(edit, oh, yeah, it's right there in the parent post....)
further, you might decide to cluster on the index or partition.