Conversation
…t and plan content of the same statement.
dyemanov
approved these changes
Apr 11, 2025
| dsc desc; | ||
|
|
||
| if ((rid == rel_mon_compiled_statements) && EVL_field(nullptr, record, f_mon_cmp_stmt_id, &desc)) | ||
| { |
Member
There was a problem hiding this comment.
fb_assert(desc.dsc_dtype == dtype_int64);
| { | ||
| stmtId = *(FB_UINT64*) desc.dsc_address; | ||
|
|
||
| if (EVL_field(nullptr, record, f_mon_cmp_stmt_sql_text, &desc)) |
| else | ||
| stmtBlobs.text.clear(); | ||
|
|
||
| if (EVL_field(nullptr, record, f_mon_cmp_stmt_expl_plan, &desc)) |
| blobsMap.put(stmtId, stmtBlobs); | ||
| } | ||
| else if ((rid == rel_mon_statements) && EVL_field(nullptr, record, f_mon_stmt_cmp_stmt_id, &desc)) | ||
| { |
Member
There was a problem hiding this comment.
fb_assert(desc.dsc_dtype == dtype_int64);
| if (!stmtBlobs.text.isEmpty()) | ||
| { | ||
| record->clearNull(f_mon_stmt_sql_text); | ||
| if (EVL_field(nullptr, record, f_mon_stmt_sql_text, &desc)) |
| if (!stmtBlobs.plan.isEmpty()) | ||
| { | ||
| record->clearNull(f_mon_stmt_expl_plan); | ||
| if (EVL_field(nullptr, record, f_mon_stmt_expl_plan, &desc)) |
| if (!stmtBlobs.text.isEmpty() || !stmtBlobs.plan.isEmpty()) | ||
| blobsMap.put(stmtId, stmtBlobs); | ||
| } | ||
| else if ((rid == rel_mon_statements) && EVL_field(nullptr, record, f_mon_stmt_cmp_stmt_id, &desc)) |
Member
There was a problem hiding this comment.
I'd add a comment that here we assume that compiled statements are stored in the dump before requests.
asfernandes
reviewed
Apr 11, 2025
Co-authored-by: Adriano dos Santos Fernandes <[email protected]>
Member
Author
|
Any objections to backport it into v5 ? |
Member
|
No, I don't mind. |
Contributor
|
Was it tested enough for a branch which is supposed to be stable? |
Member
Author
There is QA test for it. Also, snapshots of v5 often used by users. |
hvlad
added a commit
that referenced
this pull request
Apr 17, 2025
Makes MON$COMPILED_STATEMENTS and MON$STATEMENTS share blobs with text and plan content of the same statement.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Table
MON$COMPILED_STATEMENTSintroduced in ODS 13.1 with FB5 containsMON$SQL_TEXTandMON$EXPLAINED_PLANfields that duplicate contents of the same fields inMON$STATEMENTS. The size of SQL text and explained plan could be relatively big, thus it is feasible to not duplicate its, saving memory, disk and CPU circles.This PR makes engine to put statement text and plan into
MON$COMPILED_STATEMENTSonly and share blobs with corresponding record inMON$STATEMENTS(if present).