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-0006PU-BG@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
------
REL9_3_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/de6c439dc880ffa3536be7415a77ee65f56750e7

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: Limit overall indentation in rule/view dumps.
Next
From: Tom Lane
Date:
Subject: pgsql: Reduce indentation/parenthesization of set operations in rule/vi