를 발견 테스트해야 물론
top left corner
join top right corner on equal x and color and greater y
join bottom left corner on equal y and color and greater x
join bottom right on equal x, y and color
order by (x1-x2)*(y1-x2) descending
limit 1
, 그것은 어쨌든 모든 사각형을 생성해야하기 때문에 성능에 많은 영향을 증언 요구 무산 한계 일을한다.
(색상, x, y) 및 (색상, y, x) 색인을 추가하여 속도를 크게 높일 수 있습니다. 실행 계획은 거의 끝날 것입니다 :
(1) full scan for all top left corners
(2) dependent index scan for all top right corners
(3) dependent index scan for all bottom left corners
(4) dependent index scan for the bottom right corner expecting at most one match
(5) (partial) table sort of the entire set of squares (cannot use indexes)
평방근 또는 채워진 사각형? – RichardTheKiwi
공백으로 채워짐 : – 1337holiday