かなり長いので不要部分は省略します。 Sort (cost=478905.76..478905.77 rows=1 width=215) (actual time=1213518.262..1213518.264 rows=22 loops=1) Sort Key: z.mdd Sort Method: quicksort Memory: 31kB -> Subquery Scan on z (cost=478905.73..478905.75 rows=1 width=215) (actual time=1213518.163..1213518.245 rows=22 loops=1) Filter: (z.joutai = 1) -> Unique (cost=478905.73..478905.74 rows=1 width=215) (actual time=1213518.158