Multicolumn index on 3 fields with heterogenous data types

Single-column index Postgres can combine multiple indexes very efficiently in a single query with bitmap index scans. Most of the time, the most selective index is picked (or two, combined with bitmap index scans) and the rest is filtered. Once the result set is narrow enough, it’s not efficient to scan more indexes. Multicolumn index … Read more

Buffers (Circle) in PostGIS

Isn’t it just doing what is supposed to be done? Which is to compensate the distortion due to projecting the ellipsoid into a 2D flat structure? I believe, the further away you get from the equator, the more oval buffers you will see. Examples: db=# SELECT ST_AsText( ST_Buffer( ST_GeomFromText(‘SRID=4326;POINT(43.29 5.41)’),0.001, ‘quad_segs=16’) ); This query returns … Read more

Getting all Buildings in range of 5 miles from specified coordinates

Why are you storing x,y in separated columns? I strongly suggest you to store them as geometry or geography to avoid unnecessary casting overhead in query time. That being said, you can compute and check distances in miles using ST_DWithin or ST_Distance: (Test data) CREATE TABLE building (name text, long numeric, lat numeric); INSERT INTO … Read more

JPA/Hibernate Native Queries do not recognize Parameters

The use of named parameters is not defined for native queries. From the JPA specification (section 3.6.3 Named Parameters): Named parameters follow the rules for identifiers defined in Section 4.4.1. The use of named parameters applies to the Java Persistence query language, and is not defined for native queries. Only positional parameter binding may be … Read more