Skip site navigation (1) Skip section navigation (2)

Re: R-tree, order by, limit

From: Volkan YAZICI <yazicivo(at)ttmail(dot)com>
To: "Anton Belyaev" <anton(dot)belyaev(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: R-tree, order by, limit
Date: 2008-09-21 13:57:00
Message-ID: 87hc89lhzn.fsf@alamut.mobiliz.com.tr (view raw or flat)
Thread:
Lists: pgsql-general
On Sun, 21 Sep 2008, "Anton Belyaev" <anton(dot)belyaev(at)gmail(dot)com> writes:
> SELECT * FROM towns where alt1 <= alt <= alt2 AND long1 <= long <=
> long2 ORDER BY population LIMIT 10;

You're absolutely on the wrong path. Don't try to implement a logic,
that has been implemented by PostgreSQL in the most possibly efficient
way in its bounds. See geographic data types[1] (e.g. box) and
geographic functions[2] (e.g. @> a.k.a contains).


Regards.

[1] http://www.postgresql.org/docs/current/interactive/datatype-geometric.html
[2] http://www.postgresql.org/docs/current/interactive/functions-geometry.html

In response to

Responses

pgsql-general by date

Next:From: Anton BelyaevDate: 2008-09-21 14:17:39
Subject: Re: R-tree, order by, limit
Previous:From: Anton BelyaevDate: 2008-09-21 13:23:48
Subject: R-tree, order by, limit

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group