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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-general by date

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