Can improve 'limit 1' ? with slow function

Поиск
Список
Период
Сортировка
От songtebo
Тема Can improve 'limit 1' ? with slow function
Дата
Msg-id 44934c03.2b413d.146dc3c04c6.Coremail.songtebo@126.com
обсуждение исходный текст
Список pgsql-performance
The simplified scene:
select slowfunction() from a order by b limit 1
is slow than
select slowfunction() from ( select * from a order by b limit 1)
if there are many records in table 'a'

The real scene:

function  ST_Distance_Sphere is slow than ST_Distance, the query:

SELECT ST_Distance_Sphere(s, ST_GeomFromText('POINT(1 1)')) from road order by ST_Distance(s, ST_GeomFromText('POINT(1
1)'))limit 1 

is slow than:

select ST_Distance_Sphere(s, ST_GeomFromText('POINT(1 1)')) from (SELECT s from road order by ST_Distance(s,
ST_GeomFromText('POINT(11)')) limit 1) as a 

There are about 7000 records in 'road'.





В списке pgsql-performance по дате отправления:

Предыдущее
От: Mark Kirkwood
Дата:
Сообщение: Re: 60 core performance with 9.3
Следующее
От: Andres Freund
Дата:
Сообщение: Re: 60 core performance with 9.3