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

perf(core-database-postgres): add index on transactions (timestamp) #1636

Merged
merged 1 commit into from Dec 4, 2018

Conversation

Projects
None yet
3 participants
@vasild
Contributor

vasild commented Dec 4, 2018

Impact on queries:

SELECT block_id, serialized FROM transactions ORDER BY timestamp DESC OFFSET 0 LIMIT 25;
~1000ms -> ~100ms

SELECT
type,
MIN(fee) AS minFee,
MAX(fee) AS maxFee,
AVG(fee) AS avgFee,
MAX(timestamp) AS timestamp
FROM transactions
WHERE timestamp >= 53823000
GROUP BY type
ORDER BY timestamp DESC;
~350ms -> ~50ms

Proposed changes

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (improve a current implementation without adding a new feature or fixing a bug)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Build (changes that affect the build system)
  • Docs (documentation only changes)
  • Test (adding missing tests or fixing existing tests)
  • Other... Please describe:

Checklist

  • I have read the CONTRIBUTING documentation
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
perf(core-database-postgres): add index on transactions (timestamp)
Impact on queries:

SELECT block_id, serialized FROM transactions ORDER BY timestamp DESC OFFSET 0 LIMIT 25;
~1000ms -> ~100ms

SELECT
type,
MIN(fee) AS minFee,
MAX(fee) AS maxFee,
AVG(fee) AS avgFee,
MAX(timestamp) AS timestamp
FROM transactions
WHERE timestamp >= 53823000
GROUP BY type
ORDER BY timestamp DESC;
~350ms -> ~50ms

@vasild vasild requested a review from faustbrian Dec 4, 2018

@wafflebot wafflebot bot added the review label Dec 4, 2018

@codecov-io

This comment has been minimized.

codecov-io commented Dec 4, 2018

Codecov Report

Merging #1636 into develop will decrease coverage by 0.12%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1636      +/-   ##
===========================================
- Coverage    74.87%   74.74%   -0.13%     
===========================================
  Files          439      439              
  Lines         7896     7896              
  Branches      1039     1039              
===========================================
- Hits          5912     5902      -10     
- Misses        1764     1771       +7     
- Partials       220      223       +3
Impacted Files Coverage Δ
...ges/core-database-postgres/lib/migrations/index.js 100% <ø> (ø) ⬆️
packages/core-forger/lib/manager.js 71.84% <0%> (-8.74%) ⬇️
...p2p/lib/server/versions/internal/handlers/utils.js 80% <0%> (-6.67%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 83a9641...ebb43bc. Read the comment docs.

@faustbrian faustbrian merged commit d0ba656 into develop Dec 4, 2018

4 checks passed

ci/circleci: depcheck-lint Your tests passed on CircleCI!
Details
ci/circleci: test-node10-0 Your tests passed on CircleCI!
Details
ci/circleci: test-node10-1 Your tests passed on CircleCI!
Details
ci/circleci: test-node10-2 Your tests passed on CircleCI!
Details

@faustbrian faustbrian deleted the add-transactions-timestamp-index branch Dec 4, 2018

@wafflebot wafflebot bot removed the review label Dec 4, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment