PostgresQL 8.4: Common Table Expressions (CTE), performance improvement,...
Common table expressions are perhaps our favorite feature in PostgreSQL 8.4 even more so than windowing functions. Strangely enough I find myself using them more in SQL Server too now that PostgreSQL...
View ArticleUsing Recursive Common table expressions to represent Tree structures
A very long time ago, we wrote an article on how to use PostgreSQL to show the fully qualified name of an item in an inventory tree. Basically we were modeling a paper products tree. The original...
View ArticleAllocating People into Groups with SQL the Sequel
In our prior story about allocating people with the power of window aggregation, we saw our valiant hero and heroine trying to sort people into elevators to ensure that each elevator ride was not over...
View ArticleString Aggregation in PostgreSQL, SQL Server, and MySQL
Question: You have a table of people and a table that specifies the activities each person is involved in. You want to return a result that has one record per person and a column that has a listing of...
View ArticlePostGIS in Action - E-Book final version officially out
I am happy to report, that the final proof of the PostGIS in Action E-Book got released today and the printed version is scheduled for release Aprill 11th, 2011 and should be available on Amazon and...
View ArticleDifference Between CURRENT_TIMESTAMP and clock_timestamp() and how to exploit...
Question:What is the difference between CURRENT_TIMESTAMP and clock_timestamp()Answer:CURRENT_TIMESTAMP is an ANSI-SQL Standard variable you will find in many relational databases including PostgreSQL,...
View ArticleForeign Data Wrap (FDW) Text Array, hstore, and Jagged Arrays
As we discussed in file_textarray_fdw Foreign Data Wrapper, Andrew Dunstan's text array foreign data wrapper works great for bringing in a delimited file and not having to worry about the column names...
View ArticleSaying Happy Valentine in PostGIS
A while back I mentioned to Bborie (aka dustymugs) and Sandro (aka strk): We're missing ability to label our images with text. Picture this: What if someone has got a road or a parcel of land and they...
View Article