O'Reilly logo

PostgreSQL 9.0 High Performance by Gregory Smith

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Processing nodes

One you have a set of rows, the next type of node you'll encounter when using a single table are ones that process that set in various ways. These nodes typically take in a row set and output a different row set, of either the same size or smaller (perhaps only a single value).

Sort

Sort nodes can appear when you insert ORDER BY statements into your queries:

EXPLAIN ANALYZE SELECT customerid FROM customers ORDER BY zip;
QUERY PLAN
----------
Sort (cost=2104.77..2154.77 rows=20000 width=8) (actual time=162.796..199.971 rows=20000 loops=1)
   Sort Key: zip
   Sort Method:  external sort  Disk: 352kB
   ->  Seq Scan on customers  (cost=0.00..676.00 rows=20000 width=8) (actual time=0.013..46.748 rows=20000 loops=1)
 Total runtime: 234.527 ms ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required