Fascinating.
On Fri, Jul 04, 2014 at 10:47:06AM +0800, gotoschool6g wrote:
> slow query(8531 ms):
> SELECT ST_Distance_Sphere(shape,ST_GeomFromText('POINT(116.41386186784513
> 40.12211338311868)')) FROM road order by id LIMIT 1;
>
> explain output:
> "Limit (cost=4653.48..4653.48 rows=1 width=3
slow query(8531 ms):
SELECT ST_Distance_Sphere(shape,ST_GeomFromText('POINT(116.41386186784513
40.12211338311868)')) FROM road order by id LIMIT 1;
explain output:
"Limit (cost=4653.48..4653.48 rows=1 width=3612)"
" -> Sort (cost=4653.48..4683.06 rows=11832 width=3612)"
"Sort Key: id"
Martijn van Oosterhout writes:
> On Wed, Jul 02, 2014 at 04:17:13PM -0400, Tom Lane wrote:
>> It's not so much the limit as that the sort has to happen before the
>> limit, and yes, evaluation of the targetlist happens before the sort.
> I guess I assumed the column c was indexable, and it that c
On Wed, Jul 02, 2014 at 04:17:13PM -0400, Tom Lane wrote:
> David G Johnston writes:
> > Martijn van Oosterhout wrote
> >> I'm probably dense, but I'm not sure I understand. Or it is that the
> >> slowfunction() is called prior to the sort? That seems insane.
>
> > The basic reality is that limit
David G Johnston writes:
> Martijn van Oosterhout wrote
>> I'm probably dense, but I'm not sure I understand. Or it is that the
>> slowfunction() is called prior to the sort? That seems insane.
> The basic reality is that limit applies to the final set of rows that could
> be output.
It's not so
Martijn van Oosterhout wrote
> On Tue, Jul 01, 2014 at 02:36:55PM -0500, Merlin Moncure wrote:
>> On Tue, Jul 1, 2014 at 2:16 PM, Martijn van Oosterhout
>> <
> kleptog@
> > wrote:
>> > On Sun, Jun 29, 2014 at 10:05:50PM +0800, gotoschool6g wrote:
>> >> The simplified scene:
>> >> select slowfunct
On Tue, Jul 01, 2014 at 02:36:55PM -0500, Merlin Moncure wrote:
> On Tue, Jul 1, 2014 at 2:16 PM, Martijn van Oosterhout
> wrote:
> > On Sun, Jun 29, 2014 at 10:05:50PM +0800, gotoschool6g wrote:
> >> The simplified scene:
> >> select slowfunction(s) from a order by b limit 1;
> >> is slow than
>
On Tue, Jul 1, 2014 at 3:06 PM, David G Johnston
wrote:
> Merlin Moncure-2 wrote
>> On Tue, Jul 1, 2014 at 2:16 PM, Martijn van Oosterhout
>> <
>
>> kleptog@
>
>> > wrote:
>>> On Sun, Jun 29, 2014 at 10:05:50PM +0800, gotoschool6g wrote:
The simplified scene:
select slowfunction(s) from
Merlin Moncure-2 wrote
> On Tue, Jul 1, 2014 at 2:16 PM, Martijn van Oosterhout
> <
> kleptog@
> > wrote:
>> On Sun, Jun 29, 2014 at 10:05:50PM +0800, gotoschool6g wrote:
>>> The simplified scene:
>>> select slowfunction(s) from a order by b limit 1;
>>> is slow than
>>> select slowfunction(s) fr
On Tue, Jul 1, 2014 at 2:16 PM, Martijn van Oosterhout
wrote:
> On Sun, Jun 29, 2014 at 10:05:50PM +0800, gotoschool6g wrote:
>> The simplified scene:
>> select slowfunction(s) from a order by b limit 1;
>> is slow than
>> select slowfunction(s) from (select s from a order by b limit 1) as z;
>> i
On Sun, Jun 29, 2014 at 10:05:50PM +0800, gotoschool6g wrote:
> The simplified scene:
> select slowfunction(s) from a order by b limit 1;
> is slow than
> select slowfunction(s) from (select s from a order by b limit 1) as z;
> if there are many records in table 'a'.
>
>
> The real scene. Functi
The simplified scene:
select slowfunction(s) from a order by b limit 1;
is slow than
select slowfunction(s) from (select s from a order by b limit 1) as z;
if there are many records in table 'a'.
The real scene. Function ST_Distance_Sphere is slow, the query:
SELECT ST_Distance_Sphere(s, ST_Geo
12 matches
Mail list logo