pgsql: Limit overall indentation in rule/view dumps. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Limit overall indentation in rule/view dumps.
Date
Msg-id E1WfXgK-0006PS-9t@gemulon.postgresql.org
Whole thread Raw
List 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(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Fix indentation of JOIN clauses in rule/view dumps.
Next
From: Tom Lane
Date:
Subject: pgsql: Limit overall indentation in rule/view dumps.