Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swap column order in stock_i1 index in pgoltp.tcl #124

Merged
merged 1 commit into from
May 19, 2020

Conversation

marcocitus
Copy link
Contributor

This PR changes the column order in the stock_i1 index in pgoltp.tcl to be consistent with oraoltp.tcl.

This change does not affect TPC-C performance, but we often run HammerDB concurrently with the analytical queries from CH-benCHmark and see poor query plans on some PostgreSQL systems causing a single query to dominate the runtime. One the PostgreSQL committers on our team recommended the order of the stock_i1 index to improve the plans, which can make Q2 up to 500x faster without slowing down other queries or affecting TPC-C performance.

Related to #123

@sm-shaw
Copy link
Contributor

sm-shaw commented May 15, 2020

Yes also the changes look fine to me. I will test it along with the other pull request prior to the next TPC-OSS meeting on 19th May so it can be voted on for acceptance and merged next week.

@sm-shaw
Copy link
Contributor

sm-shaw commented May 19, 2020

I have run tests both with the default column ordering and with the index column order reversed. The peak result was within 0.1% so it does not seem to impact performance but re-checking the higher results where there was some variance but should not be expected as due to the change.

columorder2

Also noting that this column order for Stock is used for SQL Server, Oracle and Db2

SQL Server - CONSTRAINT [stock_i1] PRIMARY KEY NONCLUSTERED HASH ( [s_i_id], [s_w_id])
Oracle - CREATE UNIQUE INDEX STOCK_I1 ON STOCK (S_I_ID, S_W_ID) INITRANS 4 PCTFREE 1
Db2 - ORGANIZE BY KEY SEQUENCE ( S_I_ID STARTING FROM 1 ENDING AT 100000, S_W_ID STARTING FROM 1 ENDING at $count_ware )

but not for MySQL, or PostgreSQL

MySQL - PRIMARY KEY (s_w_id,s_i_id)
PostgreSQL - ALTER TABLE STOCK ADD CONSTRAINT STOCK_I1 PRIMARY KEY (S_W_ID, S_I_ID)

@sm-shaw
Copy link
Contributor

sm-shaw commented May 19, 2020

I rechecked by rerunning with the changed column order and this is all good in terms of performance

columnorder3

@sm-shaw sm-shaw merged commit 9e146f3 into TPC-Council:master May 19, 2020
@sm-shaw
Copy link
Contributor

sm-shaw commented May 19, 2020

Accepting pull request as voted on May 19, 2020 in the TPC-OSS subcommittee.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants