Skip to content

Use imporved version of Postgres' simplehash table for aggregation #8006

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

akuzm
Copy link
Member

@akuzm akuzm commented Apr 24, 2025

  • No separate status field for better memory efficiency
  • Slow path in insert function rewritten to use tail recursion for better inlining of fast path

* No separate status field for better memory efficiency
* Slow path in insert function rewritten to use tail recursion for
  better inlining of fast path
@akuzm akuzm mentioned this pull request Apr 24, 2025
13 tasks
Copy link

codecov bot commented Apr 24, 2025

Codecov Report

Attention: Patch coverage is 89.79592% with 15 lines in your changes missing coverage. Please review.

Project coverage is 82.16%. Comparing base (59f50f2) to head (7ca74ee).
Report is 915 commits behind head on main.

Files with missing lines Patch % Lines
tsl/src/import/ts_simplehash.h 89.79% 3 Missing and 12 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8006      +/-   ##
==========================================
+ Coverage   80.06%   82.16%   +2.09%     
==========================================
  Files         190      252      +62     
  Lines       37181    46431    +9250     
  Branches     9450    11644    +2194     
==========================================
+ Hits        29770    38150    +8380     
- Misses       2997     3665     +668     
- Partials     4414     4616     +202     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@fabriziomello
Copy link
Member

Why do we need to vendor Postgres simplehash.h?

@akuzm
Copy link
Member Author

akuzm commented Apr 24, 2025

Why do we need to vendor Postgres simplehash.h?

We use it for vectorized aggregation, and this is a version where I made a couple peformance-related changes as described in the PR message.

@fabriziomello
Copy link
Member

Why do we need to vendor Postgres simplehash.h?

We use it for vectorized aggregation, and this is a version where I made a couple peformance-related changes as described in the PR message.

Ahh got it ... I've just quickly looked the both code and it looked like the same but actually no (after diff them).

Comment on lines +1 to +5
/*
* This file and its contents are licensed under the Timescale License.
* Please see the included NOTICE for copyright information and
* LICENSE-TIMESCALE for a copy of the license.
*/
Copy link
Member

Choose a reason for hiding this comment

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

I know that Postgres license is very permissive, but doesn't make sense to vendor this code on Apache code?

* PostgreSQL License. Please see the NOTICE at the top level
* directory for a copy of the PostgreSQL License.
*
* PostgreSQL 17.4 f8554dee417ffc4540c94cf357f7bf7d4b6e5d80
Copy link
Member

Choose a reason for hiding this comment

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

Would be nice to have a brief explanation here about the changes you've made just for reference.


/* <element> *<prefix>_lookup(<prefix>_hash *tb, <key> key) */
SH_SCOPE SH_ELEMENT_TYPE *SH_LOOKUP(SH_TYPE * tb, SH_KEY_TYPE key);

Copy link
Member

Choose a reason for hiding this comment

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

Noticed that you removed SH_DELETE_ITEM and SH_DELETE. We don't need it? I'm just thinking that maybe this simplehash stuff can be used in other places.

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.

2 participants