From: | David Rowley <david(dot)rowley(at)2ndquadrant(dot)com> |
---|---|
To: | Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com> |
Cc: | Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: ALTER TABLE ADD COLUMN fast default |
Date: | 2018-02-20 11:38:27 |
Message-ID: | CAKJS1f9t7uWJrbkmvc5v7dSCAKvzb3688g5NTk7BHOpMzjXCpg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 20 February 2018 at 23:10, David Rowley <david(dot)rowley(at)2ndquadrant(dot)com> wrote:
> Nevertheless, it would be interesting to see how much a bsearch in
> getmissingattr would help Tomas' case. Though, perhaps you're happy
> enough with the performance already.
I thought I'd give this a quick test using the attached (incomplete) patch.
My findings made me realise that Tomas' case actually exploited a best
case for the patch.
Tomas' query.sql is performing a sum(c1000), which is the final column
in the table. No doubt he's done this since it's the typical thing to
do to get a worst case for tuple deforming, but he might not have
realised it was the best case for your patch due to the way you're
performing the for loop in getmissingattr starting with the final
missing value first.
I noticed this when I tested the mockup bsearch code. I was surprised
to see that it actually slowed performance a little with the
sum(c1000) case.
The entire results for those using:
pgbench -n -T 60 -j 1 -c 1 -f query.sql postgres
is:
Using: select sum(c1000) from t;
v11 + bsearch + create.sql: tps = 1479.267518
v11 + bsearch + create-alter.sql: tps = 1366.885968
v11 + create.sql: tps = 1544.378091
v11 + create-alter.sql: tps = 1416.608320
(both the create.sql results should be about the same here since
they're not really exercising any new code.)
Notice that the bsearch version is slightly slower, 1366 tps vs 1416.
If I use sum(c10) instead, I get.
Using: select sum(c10) from t;
v11 + bsearch + create-alter.sql: tps = 1445.940061
v11 + bsearch + create.sql: tps = 3320.102543
v11 + create.sql: tps = 3330.131437
v11 + create-alter.sql: tps = 1398.635251
The bsearch here does help recover some performance, but it's a small
improvement on what is quite a big drop from the create.sql case.
--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
Attachment | Content-Type | Size |
---|---|---|
bsearch_getmissingattr.patch | application/octet-stream | 1.6 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Kapila | 2018-02-20 11:43:03 | Re: [HACKERS] why not parallel seq scan for slow functions |
Previous Message | Simon Riggs | 2018-02-20 11:26:55 | Re: Contention preventing locking |