pgsql: Limit overall indentation in rule/view dumps.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Limit overall indentation in rule/view dumps.
Date: 2014-04-30 16:48:28
Message-ID: E1WfXgK-0006PS-9t@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Limit overall indentation in rule/view dumps.

Continuing to indent no matter how deeply nested we get doesn't really
do anything for readability; what's worse, it results in O(N^2) total
whitespace, which can become a performance and memory-consumption issue.

To address this, once we get past 40 characters of indentation, reduce
the indentation step distance 4x, and also limit the maximum indentation
by reducing it modulo 40. This latter choice is a bit weird at first
glance, but it seems to preserve readability better than a simple cap
would do.

Back-patch to 9.3, because since commit 62e666400d the performance issue
is a hazard for pg_dump.

Greg Stark and Tom Lane

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/0601cb54dac14d979d726ab2ebeda251ae36e857

Modified Files
--------------
src/backend/utils/adt/ruleutils.c | 28 ++++-
src/test/regress/expected/rules.out | 228 +++++++++++++++++------------------
2 files changed, 140 insertions(+), 116 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2014-04-30 17:26:38 pgsql: Reduce indentation/parenthesization of set operations in rule/vi
Previous Message Tom Lane 2014-04-30 16:01:36 pgsql: Fix indentation of JOIN clauses in rule/view dumps.