Read Using SQL Snippets ™ before using any of this site's sample code or techniques on your own systems.

Rows to Columns

Distributing Left to Right - Other Methods

In this topic we compare the two methods for distributing row values across columns left to right
discussed earlier, PIVOT and MAX DECODE, with two other methods sometimes used, LEAD and MODEL.
At the end of this topic a
Performance Comparison
of all techniques is given.

Note:
The tests were performed using SQL*Plus against an Oracle 11g Enterprise Edition Release 11.1.0.6.0 database running on Oracle Enterprise Linux 5.
The tests were performed on a single CPU machine.
On multi-CPU machines the MODEL solution may perform better than reported here.