You really need an index on granule_file_1.granule_uuid, which it doesn'tlook like you have. (In general you should have indexes on all foreignkeys.)