7

When we need to add an attribute to a table (e.g. a table of 350,000 polygons), my instinct is to always recreate the table so that the geometry column is last. I think this is a best practice for optimal performance, but I can't find any source to back this up. All imported shapefiles have the geometry column last, but I don't know if this is for performance reasons or not. I believe column order is important for some database platforms, but I'm not sure it is for PostgreSQL. Does anyone have an opinion?

1 Answer 1

8

No. There is no performance, or reason otherwise, to always, apart from consistency of course, have the geometry column last. I suspect the reason it is last most of the time is just historical due to PostGIS being an add-in rather then a built in shipped feature of PostgreSQL.

Most of the tables I manage have something like:

id integer
the_geom geometry
the rest of the stuff....

You can even have more then one geometry column per table, it is just a PostgreSQL type after all.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.