Sort (cost=2691.36..2691.90 rows=218 width=74) (actual time=9001.941..9002.406 rows=116 loops=1) Sort Key: pictures.date_submitted -> Nested Loop (cost=2.81..2682.89 rows=218 width=74) (actual time=202.246..8999.207 rows=116 loops=1) -> Nested Loop (cost=2.81..1989.28 rows=218 width=55) (actual time=197.489..8843.778 rows=116 loops=1) -> Bitmap Heap Scan on picture_categories (cost=2.81..633.32 rows=232 width=4) (actual time=53.420..97.865 rows=119 loops=1) Recheck Cond: (cat_id = 1725) -> Bitmap Index Scan on idx_picture_categories_cat_id (cost=0.00..2.81 rows=232 width=0) (actual time=50.193..50.193 rows=119 loops=1) Index Cond: (cat_id = 1725) -> Index Scan using pictures_pkey on pictures (cost=0.00..5.83 rows=1 width=55) (actual time=73.455..73.463 rows=1 loops=119) Index Cond: (pictures.pid = "outer".pid) Filter: ((rating_nudity <= 1::smallint) AND (rating_violence <= 1::smallint) AND (rating_sex <= 1::smallint) AND (rating_yaoi = 0) AND (rating_racism <= 1::smallint) AND (rating_spoilers <= 1::smallint) AND (rating_profanity <= 1::smallint) AND (rating_yuri = 0) AND (approved > 0)) -> Index Scan using users_pkey on users (cost=0.00..3.17 rows=1 width=23) (actual time=0.695..0.704 rows=1 loops=116) Index Cond: ("outer".user_id = users.user_id)Total runtime: 9003.221 msHere is another using another cat_id that hasn't been recently run and therefore cached data[what I was going to put here I gave up and stopped at 500 seconds of waiting, so here is a different one which should have only one row in pictures and picture_cateories]Sort (cost=2691.36..2691.90 rows=218 width=74) (actual time=2267.935..2267.939 rows=1 loops=1) Sort Key: pictures.date_submitted -> Nested Loop (cost=2.81..2682.89 rows=218 width=74) (actual time=2267.217..2267.256 rows=1 loops=1) -> Nested Loop (cost=2.81..1989.28 rows=218 width=55) (actual time=1565.461..1565.483 rows=1 loops=1) -> Bitmap Heap Scan on picture_categories (cost=2.81..633.32 rows=232 width=4) (actual time=298.460..298.465 rows=1 loops=1) Recheck Cond: (cat_id = 1) -> Bitmap Index Scan on idx_picture_categories_cat_id (cost=0.00..2.81 rows=232 width=0) (actual time=298.366..298.366 rows=1 loops=1) Index Cond: (cat_id = 1) -> Index Scan using pictures_pkey on pictures (cost=0.00..5.83 rows=1 width=55) (actual time=1266.973..1266.979 rows=1 loops=1) Index Cond: (pictures.pid = "outer".pid) Filter: ((rating_nudity <= 1::smallint) AND (rating_violence <= 1::smallint) AND (rating_sex <= 1::smallint) AND (rating_yaoi = 0) AND (rating_racism <= 1::smallint) AND (rating_spoilers <= 1::smallint) AND (rating_profanity <= 1::smallint) AND (rating_yuri = 0) AND (approved > 0)) -> Index Scan using users_pkey on users (cost=0.00..3.17 rows=1 width=23) (actual time=0.692..0.699 rows=1 loops=1) Index Cond: ("outer".user_id = users.user_id)Total runtime: 2270.102 ms