CTE that result in repeated sorting of the data

From: Jon Nelson <jnelson+pgsql(at)jamponi(dot)net>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: CTE that result in repeated sorting of the data
Date: 2014-05-15 21:27:36
Message-ID: CAKuK5J38hi5GE0b38wSyPJEG3A0H-EhqXvazWRa0xY9b6v82=A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I was watching a very large recursive CTE get built today and this CTE
involves on the order of a dozen or so "loops" joining the initial
table against existing tables. It struck me that - every time through
the loop the tables were sorted and then joined and that it would be
much more efficient if the tables remained in a sorted state and could
avoid being re-sorted each time through the loop. Am I missing
something here? I am using PG 8.4 if that matters.

--
Jon

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2014-05-15 21:37:14 Re: Proposal for CSN based snapshots
Previous Message Andres Freund 2014-05-15 21:09:14 pg_recvlogical tests