[postgis-users] Query with LIMIT but as random result set?

Nicolas Ribot nicolas.ribot at gmail.com
Tue Jan 8 07:28:52 PST 2013


Hi Stefen,

How about using random() to pick up 10 table identifiers (provided the
table contains a column with consecutive numbers, as a serial type would
do) and then perform a select on them ?

Nicolas


On 8 January 2013 16:20, Stefan Keller <sfkeller at gmail.com> wrote:

> Hi
>
> I have a query like this
>
>   SELECT ST_AsText(way) geom, name AS label
>   FROM osm_point
>   LIMIT 10;
>
> When I repeatedly do this, the result set will be always the same.
> I have observed this only empirically and I know that the ordering of
> the result set is undefined without ORDER BY.
> There are two indexes involved, one geospatial for way and one for name.
>
> My question is: Does someone have an idea on how to randomize the
> result set on every consecutive query?
> And as an option the (limited) resultset should be spatially
> distributed (not clustered).
>
> Yours, Stefan
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20130108/b12896c7/attachment.html>


More information about the postgis-users mailing list