pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Avoid O(N^2) behavior when enlarging SPI tuple table in spi_prin
7+ messages / 1 participants
[nested] [flat]

* pgsql: Avoid O(N^2) behavior when enlarging SPI tuple table in spi_prin
@ 2015-08-22 00:33 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2015-08-22 00:33 UTC (permalink / raw)
  To: pgsql-committers

Avoid O(N^2) behavior when enlarging SPI tuple table in spi_printtup().

For no obvious reason, spi_printtup() was coded to enlarge the tuple
pointer table by just 256 slots at a time, rather than doubling the size at
each reallocation, as is our usual habit.  For very large SPI results, this
makes for O(N^2) time spent in repalloc(), which of course soon comes to
dominate the runtime.  Use the standard doubling approach instead.

This is a longstanding performance bug, so back-patch to all active
branches.

Neil Conway

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/6e5d9f278c1209936d973930996857f55e119cd8

Modified Files
--------------
src/backend/executor/spi.c |    3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Avoid O(N^2) behavior when enlarging SPI tuple table in spi_prin
@ 2015-08-22 00:33 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2015-08-22 00:33 UTC (permalink / raw)
  To: pgsql-committers

Avoid O(N^2) behavior when enlarging SPI tuple table in spi_printtup().

For no obvious reason, spi_printtup() was coded to enlarge the tuple
pointer table by just 256 slots at a time, rather than doubling the size at
each reallocation, as is our usual habit.  For very large SPI results, this
makes for O(N^2) time spent in repalloc(), which of course soon comes to
dominate the runtime.  Use the standard doubling approach instead.

This is a longstanding performance bug, so back-patch to all active
branches.

Neil Conway

Branch
------
REL9_5_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/68a14ca74be03ab189b83c2bbf0b68c5d1daba44

Modified Files
--------------
src/backend/executor/spi.c |    3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Avoid O(N^2) behavior when enlarging SPI tuple table in spi_prin
@ 2015-08-22 00:33 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2015-08-22 00:33 UTC (permalink / raw)
  To: pgsql-committers

Avoid O(N^2) behavior when enlarging SPI tuple table in spi_printtup().

For no obvious reason, spi_printtup() was coded to enlarge the tuple
pointer table by just 256 slots at a time, rather than doubling the size at
each reallocation, as is our usual habit.  For very large SPI results, this
makes for O(N^2) time spent in repalloc(), which of course soon comes to
dominate the runtime.  Use the standard doubling approach instead.

This is a longstanding performance bug, so back-patch to all active
branches.

Neil Conway

Branch
------
REL9_4_STABLE

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

Modified Files
--------------
src/backend/executor/spi.c |    3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Avoid O(N^2) behavior when enlarging SPI tuple table in spi_prin
@ 2015-08-22 00:33 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2015-08-22 00:33 UTC (permalink / raw)
  To: pgsql-committers

Avoid O(N^2) behavior when enlarging SPI tuple table in spi_printtup().

For no obvious reason, spi_printtup() was coded to enlarge the tuple
pointer table by just 256 slots at a time, rather than doubling the size at
each reallocation, as is our usual habit.  For very large SPI results, this
makes for O(N^2) time spent in repalloc(), which of course soon comes to
dominate the runtime.  Use the standard doubling approach instead.

This is a longstanding performance bug, so back-patch to all active
branches.

Neil Conway

Branch
------
REL9_3_STABLE

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

Modified Files
--------------
src/backend/executor/spi.c |    3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Avoid O(N^2) behavior when enlarging SPI tuple table in spi_prin
@ 2015-08-22 00:33 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2015-08-22 00:33 UTC (permalink / raw)
  To: pgsql-committers

Avoid O(N^2) behavior when enlarging SPI tuple table in spi_printtup().

For no obvious reason, spi_printtup() was coded to enlarge the tuple
pointer table by just 256 slots at a time, rather than doubling the size at
each reallocation, as is our usual habit.  For very large SPI results, this
makes for O(N^2) time spent in repalloc(), which of course soon comes to
dominate the runtime.  Use the standard doubling approach instead.

This is a longstanding performance bug, so back-patch to all active
branches.

Neil Conway

Branch
------
REL9_2_STABLE

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

Modified Files
--------------
src/backend/executor/spi.c |    3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Avoid O(N^2) behavior when enlarging SPI tuple table in spi_prin
@ 2015-08-22 00:33 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2015-08-22 00:33 UTC (permalink / raw)
  To: pgsql-committers

Avoid O(N^2) behavior when enlarging SPI tuple table in spi_printtup().

For no obvious reason, spi_printtup() was coded to enlarge the tuple
pointer table by just 256 slots at a time, rather than doubling the size at
each reallocation, as is our usual habit.  For very large SPI results, this
makes for O(N^2) time spent in repalloc(), which of course soon comes to
dominate the runtime.  Use the standard doubling approach instead.

This is a longstanding performance bug, so back-patch to all active
branches.

Neil Conway

Branch
------
REL9_1_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/87b8c9e12f3025b70bd040c42d7d5f39ef9314bc

Modified Files
--------------
src/backend/executor/spi.c |    3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Avoid O(N^2) behavior when enlarging SPI tuple table in spi_prin
@ 2015-08-22 00:33 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2015-08-22 00:33 UTC (permalink / raw)
  To: pgsql-committers

Avoid O(N^2) behavior when enlarging SPI tuple table in spi_printtup().

For no obvious reason, spi_printtup() was coded to enlarge the tuple
pointer table by just 256 slots at a time, rather than doubling the size at
each reallocation, as is our usual habit.  For very large SPI results, this
makes for O(N^2) time spent in repalloc(), which of course soon comes to
dominate the runtime.  Use the standard doubling approach instead.

This is a longstanding performance bug, so back-patch to all active
branches.

Neil Conway

Branch
------
REL9_0_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/7c57449fc5855361d3a69374192c58fb68ce3e67

Modified Files
--------------
src/backend/executor/spi.c |    3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2015-08-22 00:33 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-08-22 00:33 pgsql: Avoid O(N^2) behavior when enlarging SPI tuple table in spi_prin Tom Lane <tgl@sss.pgh.pa.us>
2015-08-22 00:33 pgsql: Avoid O(N^2) behavior when enlarging SPI tuple table in spi_prin Tom Lane <tgl@sss.pgh.pa.us>
2015-08-22 00:33 pgsql: Avoid O(N^2) behavior when enlarging SPI tuple table in spi_prin Tom Lane <tgl@sss.pgh.pa.us>
2015-08-22 00:33 pgsql: Avoid O(N^2) behavior when enlarging SPI tuple table in spi_prin Tom Lane <tgl@sss.pgh.pa.us>
2015-08-22 00:33 pgsql: Avoid O(N^2) behavior when enlarging SPI tuple table in spi_prin Tom Lane <tgl@sss.pgh.pa.us>
2015-08-22 00:33 pgsql: Avoid O(N^2) behavior when enlarging SPI tuple table in spi_prin Tom Lane <tgl@sss.pgh.pa.us>
2015-08-22 00:33 pgsql: Avoid O(N^2) behavior when enlarging SPI tuple table in spi_prin Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox