Skip to content

optimize Date format (#1337)#1340

Merged
ti-srebot merged 10 commits intopingcap:release-5.0-rcfrom
ti-srebot:release-5.0-rc-f452ab35ada7
Jan 20, 2021
Merged

optimize Date format (#1337)#1340
ti-srebot merged 10 commits intopingcap:release-5.0-rcfrom
ti-srebot:release-5.0-rc-f452ab35ada7

Conversation

@ti-srebot
Copy link
Collaborator

cherry-pick #1337 to release-5.0-rc

What problem does this PR solve?

Problem Summary:

DateFormat is slow in TiFlash, need to optimize it.

What is changed and how it works?

What's Changed:

How it Works:

  1. avoid all sprintf in MyTimeBase::dateFormat
  2. precompile format string to avoid parsing format string everytime
  3. pre-allocate && reuse string capacity in FunctionDateFormat

Result:

on TPCH-20, with batchcop

query with optimize without optimize
select count(date_format(L_SHIPDATE, '%Y-%m-%d')) from lineitem 1.26 sec 5.14 sec

Related changes

Check List

Tests

  • Integration test
  • Manual test (add detailed scripts or steps below)

Side effects

Release note

  • optimize the performance of date_format function in TiFlash

Copy link
Contributor

@zanmato1984 zanmato1984 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ti-srebot ti-srebot added the status/LGT1 Indicates that a PR has LGTM 1. label Jan 19, 2021
@windtalker windtalker added the status/can-merge Indicates a PR has been approved by a committer. label Jan 19, 2021
@ti-srebot
Copy link
Collaborator Author

/run-all-tests

@ti-srebot
Copy link
Collaborator Author

@ti-srebot merge failed.

@windtalker
Copy link
Contributor

/merge

@ti-srebot
Copy link
Collaborator Author

/run-all-tests

@ti-srebot ti-srebot merged commit c9c9a1a into pingcap:release-5.0-rc Jan 20, 2021
@windtalker windtalker deleted the release-5.0-rc-f452ab35ada7 branch January 20, 2021 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CHERRY-PICK cherry pick status/can-merge Indicates a PR has been approved by a committer. status/LGT1 Indicates that a PR has LGTM 1.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants