Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PostGIS geometry point or PostgreSQL native point?

I need to store locations as lat long point, I tried to do comparison between postgresql point type and postgis geometry point in term of size using avg(pg_column_size:

select
    avg(pg_column_size(latlong_geomitry)) as postgis_average_size,
    avg(pg_column_size(latlong_point)) as point_average_size
from points;

for the same entry:

postgis geometry point storage size is 29 byte

postgresql point storage size is only 16 byte

I prefer to use postgis geometry point, however I don't understand why it takes more bytes to store the same data than ordinary point.

I don't need any calculation on locations (ex: distance between or any spatial features..)

So, is it ok to go with postgresql point type rather than postgis geometry point? I will preserve storage size, but would I lose in the other hand? What would be the advice?

like image 278
simo Avatar asked Oct 25 '25 09:10

simo


1 Answers

Postgis geometries contains also the type (POINT, POINTZ etc) and the SRID. This could explain the difference in size.

If you don't need calculations, and you don't have any other table with postgis geometries, I'd go with the native point and save storage.

like image 93
fradal83 Avatar answered Oct 26 '25 23:10

fradal83