tip: faster sorting for proximity queries by using cube_distance()
В списке pgsql-performance по дате отправления:
| От | Mark Stosberg |
|---|---|
| Тема | tip: faster sorting for proximity queries by using cube_distance() |
| Дата | |
| Msg-id | eqdge4$291m$1@news.hub.org обсуждение исходный текст |
| Ответ на | Re: optimizing a geo_distance() proximity query (example and benchmark) (Mark Stosberg <mark@summersault.com>) |
| Список | pgsql-performance |
Hello, I wanted to share something else I learned in my proximity search work. One my requirements is to order by the distance that matches are found from the center point. When did this using earth_distance(), the benefit of the earth_box() technique over the old geo_distance became minimal as I approached a 250mi radius. Switching to sorting by cube_distance() offered a huge benefit, allowing the earth_distance() query to run in about 100ms vs 300ms for the geo_distance() equivalent. I checked the results that cube_distance() produced versus earth_distance(). cube_distance() is always (not surprisingly) a little smaller, but the difference seems only grows to about a mile for a 250 mile radius. That's an acceptable margin of error for this application, and may be for others as well. Mark
В списке pgsql-performance по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера