Skip to content

Cubrid histogram - #24

Closed
soheejung-cs wants to merge 145 commits into
developfrom
CUBRID-HISTOGRAM
Closed

Cubrid histogram#24
soheejung-cs wants to merge 145 commits into
developfrom
CUBRID-HISTOGRAM

Conversation

@soheejung-cs

@soheejung-cs soheejung-cs commented Jan 23, 2026

Copy link
Copy Markdown
Owner

http://jira.cubrid.org/browse/CBRD-XXXX

Purpose

N/A

Implementation

N/A

Remarks

N/A


Note

Adds column histograms to improve query selectivity and planning.

  • New src/histogram/* (builder/reader/client) to create/read compact histogram blobs
  • SQL support: ANALYZE TABLE ... UPDATE HISTOGRAM ... WITH <n> BUCKETS [WITH FULLSCAN] and ANALYZE TABLE ... DROP HISTOGRAM; parser, lexer, semantic checks, name resolution, and execution implemented
  • New catalog _db_histogram and view db_histogram; wiring in schema install/constants and unload tools; DDL logging and stmt enums updated
  • Optimizer integrates histograms for = and range predicates; propagates histogram/null-frequency via PT_NAME and class stats loading
  • Class caches histogram metadata; manage load/free; drop related histograms on column rename/modify/drop and class drop
  • Core helpers: read-only object template creation, improved unique multi-attr lookup, OID writeval handling; build system includes

Risk: High — touches parser/optimizer/catalog and execution paths; impacts plan selection and DDL/ANALYZE behavior.

Written by Cursor Bugbot for commit c21c6c0. Configure here.

SOHEE_JUNG and others added 30 commits August 13, 2025 16:51
:빌드 되게 만들고 나머지 TODO 및 ASSERT 처리
- 중간부 구현: SERVER_SIDE로 가기 직전의 빌드 가능하고, 실행 가능한 상태로 중간 구현
- histogram 관련 오류 수정 (db_class fetch 방법 관련)
…/cubrid into CBRD-26217-histogram

# 제목: 변경 요약 (50자 이내)  (refactor, hotfix, feature)

# 본문: 변경 사항에 대한 자세한 설명
# - 주요 변경 사항 1
# - 주요 변경 사항 2

# 참고: 이 라인 아래의 내용은 커밋 메시지에서 제거됩니다.
class 전체의 meta 정보가 histogram에 포함되지 않도록 변경
ctshim and others added 2 commits January 27, 2026 15:04
…ld be inaccurate when a leap year was included (CUBRID#6728)

http://jira.cubrid.org/browse/CBRD-26457

* Fixed an error in adddate() and subdate() regarding the last day of a leap year.
* Fixed an error in handling negative numbers in the INTERVAL syntax.
* Changed the processing to be performed after type casting, depending on the single or composite unit.
…clause conditions are propagated as if they were WHERE clause conditions (CUBRID#6787)

Purpose
In the rewriter, qo_reduce_equality_terms is applied to all terms in the WHERE condition.
For CONNECT BY without joins, however, single_table_opt is enabled and moves conditions from the START WITH clause into the WHERE clause. As a result, terms from START WITH are treated like WHERE terms and are reduced accordingly, so the query can return wrong results.
To fix this, reduce_equality_terms is disabled when single_table_opt is enabled and the CONNECT BY query has a START WITH clause.
@soheejung-cs

Copy link
Copy Markdown
Owner Author

@codex 리뷰해줘 파일별로 정리해줘

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c21c6c0db1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/query/scan_manager.c
Comment on lines +2904 to +2908
int min_weight = (total_pages + 99) / 100; /* ensure minimum 100 pages (rounded up) */
int max_weight = total_pages / 5000; /* limit maximum 5000 pages */

/* select the smaller value between base_weight and min_weight, and greater than max_weight */
hsidp->sampling.weight = MAX (MIN (base_weight, min_weight), MAX (max_weight, 1));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Enforce minimum 100-page sampling correctly

The new sampling logic uses min_weight = (total_pages + 99) / 100 and then clamps weight with MIN(base_weight, min_weight), which makes the sample size roughly total_pages / weight. This caps the sample to ≤100 pages instead of guaranteeing ≥100 pages. For example, with 150 pages, min_weight becomes 2, so the scan samples about 75 pages—below the stated “minimum 100 pages.” This under-samples mid-sized tables (≈101–299 pages) and weakens statistics accuracy. To honor the minimum, the weight should be bounded by floor(total_pages/100) (or another clamp that ensures sample_size ≥ 100 when total_pages ≥ 100).

Useful? React with 👍 / 👎.

kangmin5505 and others added 25 commits January 28, 2026 18:31
…#6794)

http://jira.cubrid.org/browse/CBRD-26507

feature: exclude auto-increment columns from db_serial view

Updated the db_serial system catalog view to filter out sequences associated with auto-increment columns. This is achieved by excluding records in _db_serial that have a non-null class_name.
…ion function (CUBRID#6805)

restore next field of a SP call node in the parse tree before returning from XASL conversion function
http://jira.cubrid.org/browse/CUBRIDQA-1338


* Test: Add artifact API access test in build job

- Package CUBRID build as tar.gz and store as artifact
- Test CIRCLECI_TOKEN API access to verify artifact retrieval
- This is a prerequisite test for GlusterFS build cache implementation

* Implement artifact-based build distribution for sql/medium tests

- Build job now stores CUBRID.tar.gz as artifact instead of workspace
- Workspace only contains BUILD_NUM (few bytes vs 248MB)
- Add download-build-from-artifact command for test jobs
- test_medium and test_sql now download build from artifact API
- Remove attach_workspace from attach-and-run-tests command

This reduces workspace transfer from 248MB to few bytes per test job.

* Add GlusterFS-based build cache for shell tests

- Add download-build-to-glusterfs command to save build artifacts to shared storage
- Add download-build job (parallelism: 1) to download once for all shell test pods
- Update workflow: shell tests now depend on download-build instead of build directly
- This reduces network transfer from 15GB (50 pods x 300MB) to 300MB (1 download)

* Use CIRCLE_SHA1 for build cache to enable reuse across workflow retries

- Change build cache key from CIRCLE_WORKFLOW_ID to CIRCLE_SHA1
- This allows reusing the same build artifact for the same commit
- Benefits: if tests fail and workflow is retried, build download is skipped
- GlusterFS path: /home/build-cache/builds/{commit-hash}/CUBRID

* Stop after build logs on default trigger

Halt the build job after collect-build-logs when the branch name does not include /head.
… returns_null_on_function_errors=yes (CUBRID#6803)

http://jira.cubrid.org/browse/CBRD-26518

* Fixed an error where adddate() would not return NULL even when return_null_on_function_errors=yes
…BRID#6811)

[CMS] add overwrite_exvol_file key to createdb for ext vol creation
http://jira.cubrid.org/browse/CBRD-26491

* feature: add debugging method of bison(csql, loaddb)
* refactor: remove old version bison debugging code(related with PARSER_DEBUG)
* refactor: remove old version bison debugging code(related with DBG_TRACE_LEVEL)
# 제목: 변경 요약 (50자 이내)  (refactor, hotfix, feature)

# 본문: 변경 사항에 대한 자세한 설명
# - 주요 변경 사항 1
# - 주요 변경 사항 2

# 참고: 이 라인 아래의 내용은 커밋 메시지에서 제거됩니다.
…UBRID#6828)

depending on the success or failure of optimizedb, return status correctly
…#6684)

http://jira.cubrid.org/browse/CBRD-26410

Improves performance degradation of query execution when the SQL_TRACE_EXECUTION_PLAN system parameter is set.
…not change (CUBRID#6831)

http://jira.cubrid.org/browse/CBRD-26535

* Assign the const keyword to variables whose values ​​do not change
…ved (CUBRID#6833)

http://jira.cubrid.org/browse/CBRD-23700

- modified to also delete  lob files of the table in the following cases :
  * when dropping or truncating a table included lob type
  * when dropping a lob column
- modified to also delete unnecessary directories.
- add HFID values as parent directory to express the relationship between lob files and tables.
# 제목: 변경 요약 (50자 이내)  (refactor, hotfix, feature)

# 본문: 변경 사항에 대한 자세한 설명
# - 주요 변경 사항 1
# - 주요 변경 사항 2

# 참고: 이 라인 아래의 내용은 커밋 메시지에서 제거됩니다.
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.

10 participants