22
Now on with the show. General Overview Feature SQL Server 2008 Release 2 Oracle 11G Release 2 PostgreSQL 8.4/PostGIS 1.5 OS Windows XP, Windows Vista, Windows 2003, Windows 2008 (runs in both 32-bit and 64-bit) R2 does not yet work on Mac apparently,10G seems to be the last to work on Mac. Linux, Unix, Windows 2003, Windows 2008 (runs in both 32-bit and 64-bit) Windows 2000+ (including Vista, 2003, Windows 7, 2008) - (currently only runs in 32-bit mode for windows, but can allocate more memory than the 4 gig limit partly because its multi-process (rather than multi-threaded) and delegates much of memory management to the OS), Linux, Unix, Mac (both 32-bit/64-bit supported for all non-Windows OS) Licensing Proprietary - Closed Source, Various levels of features based on version, Express version has full spatial support but limitation on database Proprietary Closed Source comes in free Express with Oracle Locator, Standard, Standard Edition One packaged with Oracle Locator, Enterprise FLOSS (PostgreSQL is BSD, PostGIS is GPL Open Source - you can use for commercial apps but if you make changes to the core libraries of PostGIS, you need to

Sql2008 vs Oracle 11g

Embed Size (px)

Citation preview

Page 1: Sql2008 vs Oracle 11g

Now on with the show.

General Overview

Feature SQL Server 2008 Release 2 Oracle 11G Release 2 PostgreSQL 8.4/PostGIS 1.5

OSWindows XP, Windows Vista, Windows 2003, Windows 2008 (runs in both 32-bit and 64-bit)

R2 does not yet work on Mac apparently,10G seems to be the last to work on Mac. Linux, Unix, Windows 2003, Windows 2008 (runs in both 32-bit and 64-bit)

Windows 2000+ (including Vista, 2003, Windows 7, 2008) - (currently only runs in 32-bit mode for windows, but can allocate more memory than the 4 gig limit partly because its multi-process (rather than multi-threaded) and delegates much of memory management to the OS), Linux, Unix, Mac (both 32-bit/64-bit supported for all non-Windows OS)

Licensing

Proprietary - Closed Source, Various levels of features based on version, Express version has full spatial support but limitation on database size and only use one processor.

Proprietary Closed Source comes in free Express with Oracle Locator, Standard, Standard Edition One packaged with Oracle Locator, Enterprise packaged with Oracle Locator with option to buy Oracle Spatial add-on

FLOSS (PostgreSQL is BSD, PostGIS is GPL Open Source - you can use for commercial apps but if you make changes to the core libraries of PostGIS, you need to give that back to the community)

Versions and Pricing Pricing DetailsExpress - free limit 1 processor, 10 gig db Note that SQL Server 2008 had a 4gig limitStandard - starts at ~$7500 per processor limit 4 processorsEnterprise ~$29,000 per processorDatacenter - ~$58,000 per

Pricing ListExpress (XE) Free 1 processor, 4 gb db, 1 gig ramPersonal Edition ~$450 per user Standard Edition One ~$5800 per proc Standard Edition ~$17,500 per proc

In the famous words of Jeff Atwood, much like other Open Source software, there is only one edition - The Awesome Edition. If you don't want to spend your life figuring out why you can't use all your memory or processors or whether you are in violation of your license for accidentally using a function you

Page 2: Sql2008 vs Oracle 11g

processorParallel Data Warehouse - ~$58,000 per processor Prices negotiable, but not as negotiable as Oracle unless buying in volume.

Enterprise Edition ~47,500 per proc + option to buy Oracle Spatial add on for another $17,500 per proc NOTE: We hear these prices are very negotiable if you consider fighting with sales reps a fun sport and a good use of your time and/or you are big enough to not be laughed out of the room.

weren't supposed to, or waiting for your loan to be approved so you can buy that extra database processor license for that extra processor you just added to your awesome server, then PostGIS is probably your answer.

Free GIS Data and ETL Loaders

shp dataloader for SQL Server 2008 developed by Morten Nielsen

shp2sdo packaged with Oracle, OGR2OGR (not compiled in by default needs Oracle libraries), GeoKettle

included shp2pgsql, shp2pgsql-gui (introduced in PostGIS 1.5) which is a graphical equivalent of the shp2pgsql commandline loader, OGR2OGR (no license required to compile in and many precompiled binaries have it compiled in), QuantumGIS SPIT, SHP loader for PostGIS also developed by Morten using SharpMap.NET, GeoKettle, Spatial Data Integrator

Commercial GIS Data Loaders

Safe FME Objects, ESRI ArcGIS 9.3+ (in a later service pack), Cadcorp

Safe FME Objects, ESRI ArcGIS (all versions)

Safe FME Objects, ESRI ArcGIS 9.3+, CadCorp

Application drivers available specifically for spatial component

SharpMap.NET (thanks Bill Dollins), NetTopologySuite

OGR/GDAL, SharpMap.NETSharpMap.NET, JDBC postgis.jar included with postgis, JTS etc. tons for Java, OGR/GDAL

Free Object/Relational Mapping

HibernateSpatial NHibernateSpatial (this is a .NET object relational spatial mapper) (just geometry)

Hibernate Spatial - this is a java object relational mapper, NHibernate Spatial

NHibernateSpatial and HibernateSpatial (just geometry)

Free Desktop Viewers and Built into packaged SQL Manager Packaged with Oracle via OpenJump, QuantumGIS, GvSig,

Page 3: Sql2008 vs Oracle 11g

Editors

OBE, GvSig, QuantumGIS (via additional extensions), OpenJump (via additional extensions), uDig, GeoRaptor for Oracle SQL Developer

uDig

Commercial Desktop Viewers and Editors

ESRI ArcGIS 9.3 Server SDE, Manifold, CadCorp, Autocad FDO, MapInfo 10+

ESRI ArcGIS SDE (all versions), FME, Manifold,CadCorp, Autocad FDO, MapInfo

ESRI ArcGIS 9.3 Server, ZigGIS for ArcGis/ArcMap desktop, Manifold, FME, CadCorp, Autocad FDO, MapInfo 10+

Web Mapping ToolKits - it must be said things like OpenLayers and various other scripting frameworks that can accept GML will work with any of these databases and your favorite web scripting language

Manifold, MapDotNet, ArcGIS 9.3 (with ArcSDE license), UMN MapServer see, GeoServer, MapGuide Open Source (using beta FDO driver)

Manifold, MapDotNet, UMN Mapserver, GeoServer, MapGuide Open Source, ArcGIS all versions (with ArcSDE license)

Manifold, MapDotNet, ArcGIS (9.3+ with ArcSDE license), UMN Mapserver, GeoServer, FeatureServer, MapGuide Open Source (FDO beta driver)

Spatial FunctionsBoth OGC SFSQL MM and Geodetic custom (over 70 functions)

A fair number and even esoteric ones for geodetic and planar (2D), but fundamental stuff like intersections and unions you aren't licensed to do with Locator product. On the upside we hear the nearest neighbor NN packaged in both Locator and Spatial rocks.

Over 300 functions and operators, geodetic support in PostGIS 1.5 for all basic types mostly focused on proximity calculations, most SQL/MM 2D and some 2.5D, basic MM curved support

Spatial Indexes (IBM DB2 uses quadtree, Spherical Voronoi Tessalation, IBM Informix uses R-Tree. Note R-Tree indexes are self-tuning and do not require grid setup, but with grids you

Yes - 4 level Multi-Level grid hierarchy (BOL says its B-Tree based) with tessalation as described Isaac Kunen Multi-Level Grid requires defining an index grid for optimal performance

R-Tree GIST - a variant of R-Tree

Page 4: Sql2008 vs Oracle 11g

may be able to squeeze out extra performance with a bit more effort)

True Geodetic support - support for true measurement along a spherical coordinate (it must be noted IBM provide geodetic support, although IBM Informix/DB2 have it as an additional priced Blade add-on in addition to standard planar spatial)

Yes - with caveats - must use Geography type which has the following constraints: no single geometry may overlap hemispheres, most operations involving 2 geometries, such as intersections, are undefined for geometries more than a hemisphere apart. SRID must be defined in spatial ref. Orientation of polygons is important in Geography. Fewer spatial functions available for geography than geometry

Yes as a single type geometry. Oracle does do some under the covers transformation when doing operations on geodetic data it has no internal support for and also allows operations between two geometries with different SRIDS.

Yes - PostGIS followed same model as SQL Server -- two type geometry and geography. Geography is however currently limited to only WGS 84 long lat. While you can stuff more than a hemisphere in a geography field you shouldn't since distance/intersection calculations will be often wrong because it uses great circle model. SQL Server 2008 prevents you from making this mistake.

Hosting Options - If you are doing any serious spatial with any of these, you really should get your own dedicated server.

Many, but only windows hosting which tends to still be pricier and less plentiful than Linux hosting. With a shared box, you usually can't install CLR stuff. There is also SQL Azure for cloud computing which now supports spatial, though evidentally no custom CLR install. If you need the added functions provided by Spatial Tools project, SQL Azure is not currently a happy option.

Few and expensive unless you do express. Probably need your own dedicated server and pay your own licensing then you can use any dedicated Linux/Windows hosting and manage your own.

Although not widely publicized, the dedicated hosting story for PostgreSQL/PostGIS is better than it is for Oracle or SQL Server 2008 (as far as spatial is concerned). If you have a dedicated Linux/Windows hosted server, and aren't afraid to be your own admin (or to get a qualified consultant such as us to help out with mentoring and advanced support). Number of spatial consultants with PostGIS experience is increasing rapidly. Refractions and OpenGeo are the frontrunners for Enterprise level support contracts and full service

Page 5: Sql2008 vs Oracle 11g

GIS training with specific focus on PostGIS and open source GIS. Most of the PostGIS core developers work for companies providing consulting support around PostGIS and at generally lower or comparable price you would get for Oracle or SQL Server spatial. By consulting with them, not only do you get great support, but you can sponsor additional features in PostGIS that you need for your particular workload. Many many more smaller consultants focused on just the PostGIS side. You can host on any cloud thing like Amazon EC or GoGrid or any dedicated server for that matter. Many Linux distros provide PostgreSQL/PostGIS via Yum or apt-get so a fairly painless install. Windows pre-compiled installs are available for the latest PostGIS/PostgreSQL via Stackbuilder, and a click - next next 5-10 minute install away. You can host on Linux or Windows and they won't be throwing in any additional database licensing cost on to your bill as they do with Oracle and SQL Server. List of community recommended Hosters good for PostGIS.

Page 6: Sql2008 vs Oracle 11g

Now for this section, we can't really itemize all the functions of each offering. We will just focus on the functions we consider most commonly used in spatial analysis, web applications and geoprocessing. For this section we are treating SQL Server 2008 and PostGIS as two products because functionality available for their planar (Geometry) is not the same as functionality available for their Geography. In theory you can convert between the 2 types by using the GeomFromWKB and AsBinary functions that each type provides if they have the same SRID, but without Transform function support (that SQL server 2008 still lacks built-in), this is of limited use in SQL Server.

As mentioned we are treating each as two separate products.

Spatial Functionality

Feature

SQL Server

2008 R2 Geometry

SQL Server 2008 R2

GeographyOracle Locator Oracle Spatial

PostgreSQL 8.4/PostGIS 1.5

Geometry

PostgreSQL 8.4/PostGIS

1.5 Geography

Supported Geometry Types

OGC basic types 2D/2.5D, but no curved support.

OGC basic types 2D/2.5D, but no curved support.

OGC basic types 2D/2.5D, with curved support.

OGC basic types 2D/2.5D/3D with curved support (can do volumetric 3D support).

OGC basic types 2D/2.5D, with curved support.

OGC basic types 2D/2.5D, with no curved support.

Transform - ability to transform from one spatial ref to another

No - need 3rd-party tools, Geometry can use any SRID between 0 and 999999. Spatial Tools free CLR add-

No, but less need for transform since spherical coordinates that cover the globe can be used. SRID must be defined in sys.spatial_reference_system

Yes - SDO_CS package SDO_CS.TRANSFORM

Yes - same as Locator

Yes - ST_Transform No but easy-work around ST_Transform(geometry(geog), desiredsrid)

Page 7: Sql2008 vs Oracle 11g

on does provide limited transform support.

s

Geometry Output functions - these are important particular for web-development when using the various javascript, flash apis

STAsBinary, STAsText, AsGML (only 3.0), AsTextZM, a builder api for extending to support more output formats

Same as the geometry ones

Get_WKB, GET_WKT, SDO_UTIL package TO_WKBGEOMETRY, TO_WKTGEOMETRY, TO_GML311GEOMETRY, TO_GMLGEOMETRY, TO_KMLGEOMETRY

Same as Locator

ST_AsBinary, ST_AsText, ST_AsSVG, ST_AsGML (both 2 and 3 version), ST_AsKML (both 2 and 3 version), ST_AsGeoJson, ST_AsEWKT, ST_AsHexEWKB

Same as for geometry

Geometry Input functions

STGeomFromText, STGeomFromWKB, GeomFromGML (only 3.0 version)

Same as Geometry

SDO_Geometry (accepts WKT and binary), and array input version, SDO_UTIL package: FROM_GML311GEOMETRY, FROM_GMLGEOMETRY , FROM_GML311GEOMETRY, FROM_KMLGEOMETRY

Same as Locator

ST_GeomFromText, ST_GeomFromWKB, ST_GeomFromGML*, ST_GeomFromKML* (GML and KML input are new in 1.5)

ST_GeogFromText, ST_GeogFromWKB, no GML and KML input. Easy workaround geography( ST_Transform ( ST_GeomFromGML( somegml ), 4326 ) )

Intersects,Intersection,Difference,

STIntersects,

Same as geometry

SDO_Intersects no Intersection, Union or

via SDO_GEOM SDO_DIFFERENCE

ST_Intersects, ST_Intersection,

ST_Intersects (native

Page 8: Sql2008 vs Oracle 11g

Basic Union

STIntersection, STUnion, STSymDifference (spatial ref of both geoms must be the same)

except an intersection resulting in a polygon that overlaps 2 hemispheres will return null

difference

, SDO_INTERSECTION, SDO_UNION (can span different spatial refs too)

ST_Union, ST_Difference, ST_SymDifference (spatial refs of both geoms must be the same)

support), ST_Intersection (intersection relies on internal transform to best fitting spatial ref and then convert back to geography)

Other Non-Agg key relationship and relation outputs

spatial ref must be the same: STContains, STDifference, STDisjoint, STEquals, STIntersects, Filter, STOverlaps, STRelate (SQL Server doesn't support the variant that returns the matrix that PostGIS and Oracle

Spatial ref must be the same: STDisjoint, STIntersects

All relationship operators in Oracle Spatial are available in Locator (except for SDO_GEOM.RELATE): Most of these return true/false based on Oracle RELATE MASKS except for the NN, NN_DISTANCE (spatial ref can be different) - SDO_ANYINTERACT (means they are not Disjoint -- they intersect) , SDO_CONTAINS , SDO_COVEREDBY , SDO_COVERS , SDO_EQUAL , SDO_FILTER , SDO_INSIDE (this is

Same as locator + SDO_GEOM.RELATE (note: RELATE returns the MASK keywords that define the relationship, SDO_RELATE returns if 2 geometries are related by the passed in matrix)

Spatial ref must be the same: ST_Contains, ST_CoveredBy, ST_Covers, ST_Disjoint, ST_Difference, ST_DWitin (this is similar in concept to Oracle SDO_Within_Distance), ST_Equals, ST_Intersects, ST_Overlaps, ST_Relate (overloaded function -- one variant returns true (similar similar to Oracle's SDO_RELATE, and the other returns the matrix SDO_GEOM.RELATE), ST_Touches, ST_Within, &&

Spatial ref must be the same: ST_CoveredBy, ST_Covers, ST_DWithin,ST_Intersects, && is closest equivalent to Oracle and SQL Server SDO_Filter, filter operations.

Page 9: Sql2008 vs Oracle 11g

Spatial offer), STSymDifference, STTouches, STWithin Note STDIstance() < somevalue is equivalent to PostGIS ST_DWithin and Oracle SDO_Within_Distance and uses a spatial index just as those do

presumably what PostGIS and SQL Server call ST_/STWithin) , SDO_JOIN , SDO_NN , SDO_NN_DISTANCE , SDO_ON , SDO_OVERLAPBDYDISJOINT , SDO_OVERLAPBDYINTERSECT , SDO_OVERLAPS , SDO_RELATE , SDO_TOUCH , SDO_WITHIN_DISTANCE

Accessors, Editors, Processors, Relationship outputs (OGC type)

BufferWithTolerance (this is similar to PostGIS variant of Buffer that takes 3 args (defaulted to 8

Long,Lat, NumRings, RingN, STArea, STBuffer, STDimension, STEndpoint,STGeometryN, STGeometryType, STIsClosed,

All functions in the mdsys package which includes ST_Centroid, ST_ConvexHull. All functions in SDO_GEOM package: SDO_BUFFER, SDO_CENTROID, SDO_CONVEXHULL, SDO_POINTONSURFACE,

Everything in mdsys + SDO_GEOM. including SDO_DIFFERENCE, SDO_INTERSECTION

ST_Boundary, ST_Buffer (2 variants similar to STBuffer and BufferWithTolerance), ST_Centroid, ST_ClosestPoint, ST_ConvexHull, ST_Dimension, ST_EndPoint, ST_ExteriorRing, ST_GeometryN,

ST_Buffer most other functions you need to cast to geometry and then back to geography. Full list

Page 10: Sql2008 vs Oracle 11g

number of segs to use to approximate a quarter circle), MakeValid, Reduce - similar to PostGIS ST_Simplify, STBoundary, STBuffer,STCentroid, STConvexHull, STDimension, STEndPoint, STExteriorRing, STGeometryN, STGeometryType, STInteriorRingN, STIsClosed, STIsEmpty

STIsEmpty, STLength, STNumGeometries, STNumPoints, STPointN, STSrid, STStartPoint, STUnion

SDO_TRIANGULATE. EXCEPT FOR: SDO_DIFFERENCE, SDO_INTERSECTION, SDO_UNION, RELATE

ST_GeometryType, ST_InteriorRingN, ST_IsClosed, ST_IsEmpty,ST_IsRing, ST_ISSimple, ST_IsValid, ST_Length, ST_LongestLine, ST_NumGeometries, ST_NumInteriorRings, ST_NumPoints (only applies to linestrings), ST_NPoints - returns num vertexes regardless of geometry type, ST_NumInteriorRings, ST_PointN, ST_ShortestLine, ST_Simplify, ST_StartPoint, ST_SRID, ST_Translate, ST_Union,ST_X, ST_Y

Page 11: Sql2008 vs Oracle 11g

, STIsSimple, STIsValid, STNumGeometries, STNumInteriorRing, STNumPoints (only applies to LINESTRINGS), STPointN(, STStartPoint, STSRID, STUnion, sTX,STY

Extra non-OGC non-Aggregate type functions used in higher processing

MakeValid ( affine and translate functions available via Spatial Tools CLR add-on)

none IN SDO_GEOM - SDO_ALPHASHAPE, SDO_ARC_DENSIFY, SDO_CLOSEST_POINTS, SDO_CONCAVEHULL, SDO_TRIANGULATE, VALIDATE_GEOMETRY_WITH_CONTEXT, VALIDATE_LAYER_WITH_CONTEX IN SDO_UTIL - AFFINETRANSFORM

Same as locator ST_Affine, ST_AddPoint, ST_BuildArea, ST_ClosestPoint, ST_CollectionExtract, ST_CurveToLine (similar to Oracle SDO_ARC_DENSIFY), ST_Dump, ST_DumpPoints, ST_DumpRings, ST_IsValidReason (similar in concept to Oracle

None - but many you can get by casting between geography and geometry

Page 12: Sql2008 vs Oracle 11g

S (AFFINETRANSFORMS is new in 11G but workarounds for older versions), APPEND, BEARING_TILT_FOR_POINTS, ELLIPSE_POLYGON,EXTRACT, EXTRACT3D (similar in concept to PostGIS ST_Dump* and ST_CollectionExtract functions), REVERSE_LINESTRING

VALIDATE_GEOMETRY_WITH_CONTEXT), ST_LineToCurve, ST_LongestLine, ST_MakeLine,ST_MinimumBoundingCircle, ST_Reverse (similar to Oracle REVERSE_LINESTRING, except works for all geometries), ST_SetPoint, ST_ShortestLine, ST_Translate

Measurement

STArea, STLength (for Polygons gives the perimeter), STDistance (measurements in unit of spatial ref)

Same as geometry - measurements in meters and sq meters

via mdsys.st_polygon new in 11G (ST_Area, ST_Length) -- always had ST_Distance with choice of units.

via mdsys.st_polygon and SDO_Geom - ST_Area, ST_Length, ST_Distance with choice of units.

ST_Area, ST_Distance, ST_Distance_Spheroid, ST_HausdorffDistance, ST_Length, ST_Perimeter, ST_Length_Spheriod , ST_MaxDistance (non-sphere, non-spheriod functions units are in spatial ref, sphere and spheroid are in meters)

ST_Area, ST_Distance, ST_Length (also works for polygons and behaves as ST_Perimeter), units always in meters/sq meters

Linear Referencing - things like returning fractions of

None built in, but availabe via free extension -

none built in - check out new SQL Server Spatial tools code plex

none Yes (SDO_LRS package) DEFINE_GEOM_SEGMENT, REDEFINE_GEOM

ST_AddMeasure ST_Line_Interpolate_point, ST_Line_Substring, ST_line_locate_point, ST_locate_along_measu

No but can cast back and forth between geography and geometry to use

Page 13: Sql2008 vs Oracle 11g

lines, approximating point location along a line based on num address

Linear referencing functions already built in the new CodePlex SQL Server Spatial Tools project.

project

_SEGMENT, CLIP_GEOM_SEGMENT, CONCATENATE_GEOM_SEGMENTS, LRS_INTERSECTION (same as PostGIS ST_Intersection,STIntersection), SPLIT_GEOM_SEGMENT, TRANSLATE_MEASURE, REVERSE_MEASURE

re, ST_locate_between_measures

most geometry linear functions

Spatial Aggregates (functions like SUM but for spatial) - PostGIS and Oracle Spatial are clearly winners here

None, but free open source SQL Server Spatial Tools add-on includes some as CLR functions. SQL Server 2008 Spatial Tools

GeographyUnion via SQL Server 2008 Spatial Tools free CLR library

All aggregates supported in Oracle Spatial except for SDO_AGGR_UNION according to this.

Yes - SDO_AGGR_CENTROID, SDO_AGGR_CONCAT_LINES, SDO_AGGR_CONVEXHULL, SDO_AGGR_LRS_CONCAT, SDO_AGGR_MBR, SDO_AGGR_SET_UNION, SDO_AGGR_UNION and with Oracle Spatial R2, you can even do a

ST_Extent, ST_Collect, ST_Union (can be used for any geometry -- so combines functionality of Oracle SDO_AGG_Union, SDO_AGGR_CONCAT_LINES), ST_Accum, ST_MakeLine, ST_Polygonize and also supports overloaded functions for these that take as input arrays of geometry objects. It must be noted that most of the Oracle aggregates

none

Page 14: Sql2008 vs Oracle 11g

contains aggregate functions Geometry Envelop similar to PostGIS ST_Extent and Oracle Aggr_MBR functions for geometry

ST_Union_Set which has existed forever in PostGIS.

are supported here by another name or can be easily replicated using ST_Collect or ST_Union and another function - e.g. ST_ConvexHull( ST_Collect( geom ) ) = SDO_AGGR_CONVEXHULL. ST_Centroid(ST_Union(geom)) = SDO_AGGR_CENTROID, ST_Union(array_of_geoms) = SDO_AGGR_SET_UNION, ST_Extent = SDO_AGGR_MBR.