...Although granule_file has an index as a foreign key, it seems to me that it is not being considered.
pgsql-performance by date:
Соглашаюсь с условиями обработки персональных данных