Skip to content

Conversation

mariadb-RexJohnston
Copy link
Member

This is split from MDEV-36861 where we are investigating performance issues comparing 10.11 with 11.4

Here we are adding in a missing component to push up the cost of a disk based temp table lookup. This is needed to change the plan for Query 4 of the TPC-H performance suite test.

  • The Jira issue number for this PR is: MDEV-37723

Description

Tweak disk based temporary table costs to optimize Query 4 of TPC-H HammerDB test suite.

Release Notes

TODO: What should the release notes say about this change?
Include any changed system variables, status variables or behaviour. Optionally list any https://mariadb.com/kb/ pages that need changing.

How can this PR be tested?

TODO: modify the automated test suite to verify that the PR causes MariaDB to behave as intended.
Consult the documentation on "Writing good test cases".

If the changes are not amenable to automated testing, please explain why not and carefully describe how to test manually.

Basing the PR against the correct MariaDB version

  • This is a new feature or a refactoring, and the PR is based against the main branch.
  • This is a bug fix, and the PR is based against the earliest maintained branch in which the bug can be reproduced.

PR quality check

  • I checked the CODING_STANDARDS.md file and my PR conforms to this where appropriate.
  • For any trivial modifications to the PR, I am ok with the reviewer making the changes themselves.

(Patch provided by Monty, Testcase by Rex Johnston)

get_tmp_table_costs() computes the cost of using a temporary (work
table) for certain cases, including semi-join subquery materialization.

The computed cost value was very low, it used this formula:
  key_lookup_cost * (disk_read_ratio= 0.02)

Use the correct formula:

   key_lookup_cost // Index lookup is always done
   +
   disk_read_cost * disk_read_ratio

disk_read_cost is incurred when the lookup has to go to disk.
We assume this doesn't occur for every lookup. It happens only with
disk_read_ratio= 0.02 frequency.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants