[postgis-users] To OID or not to OID?

Bruce Rindahl rindahl at lrcwe.com
Thu Dec 14 12:15:54 PST 2006


I am creating and populating a table with X and Y values as attributes.
After the table is created I will add a geometry column and populate it with
points from the X and Y attributes.  My question is what is the better
approach?  Something like this?

CREATE TABLE wells
(
  receipt varchar(8),
  utm_x float8,
  utm_y float8
) 
WITH OIDS;
SELECT AddGeometryColumn('','wells','the_geom','26913','POINT',2);

Or the method used by shp2pgsql?

CREATE TABLE wells
 (
   gid serial PRIMARY KEY,
   receipt" varchar(8),
   utm_x" numeric,
   utm_y" numeric
);
SELECT AddGeometryColumn('','wells','the_geom','26913','POINT',2);

In the first method the oid field becomes the primary key where in the
second method the gid field becomes the primary key.

Is there a performance difference?

Thanks
Bruce Rindahl





More information about the postgis-users mailing list