-
-
Notifications
You must be signed in to change notification settings - Fork 264
Feature #1095 - LOCAL TEMPORARY TABLE #8860
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
base: master
Are you sure you want to change the base?
Conversation
| ### Temporary storage in read-only databases | ||
|
|
||
| Since LTT definitions are not stored in the database, they can be created and used in read-only databases. This is not | ||
| possible with Global Temporary Tables, which require metadata modifications. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For GTT "created" and "used" is different - while it really can't be created in RO database, it can be used there.
| | Metadata storage | System tables (`RDB$RELATIONS`, etc.)| Connection memory only | | ||
| | Visibility of definition | All connections | Creating connection only | | ||
| | Persistence of definition | Permanent (until explicitly dropped) | Until connection ends | | ||
| | Read-only database support | No | Yes | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above
| | Indexes | Full support | Basic support (no expression/partial) | | ||
| | DDL triggers | Fire on CREATE/DROP/ALTER | Do not fire | | ||
| | DML triggers support | Yes | Not supported | | ||
| | Constraints (PK, FK, CHECK) | Supported | Not supported | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Field level NOT NULL constraint is supported by LTT, so I offer to split this row by two:
"Field level NOT NULL constraints" and "Other constraints (PK, FK, CHECK)"
| { | ||
| ERR_post(Arg::Gds(isc_imp_exc) << | ||
| Arg::Gds(isc_random) << | ||
| Arg::Str("Local temporary table limit exceeded")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not clear which limit is exceeded, imho. Maybe "Too many local temporary tables exists already" or so on...
| MET_dsql_cache_release(tdbb, SYM_relation, name); | ||
|
|
||
| if (!(relation->rel_flags & REL_ltt_created)) | ||
| MET_dsql_cache_release(tdbb, SYM_relation, name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like LTT can't be here. See above at line 8282
| { | ||
| const auto ltt = lttEntry.second; | ||
| if (ltt->relationId == id && ltt->relation) | ||
| return ltt->relation; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to call MET_relation() with id of being created LTT ?
|
|
||
| // LTT not found - unlike normal relations, LTTs are not auto-created by this function | ||
| fb_assert(false); | ||
| status_exception::raise(Arg::PrivateDyn(61)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put in comments content of unnamed error message (DYN 61), please.
Also, usage of DYN error code in MET looks weird.
| if (relation->rel_flags & REL_blocking) | ||
| if ((relation->rel_flags & REL_blocking) && | ||
| !(relation->rel_flags & REL_temp_ltt) && | ||
| relation->rel_existence_lock) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it required to check for both conditions (REL_temp_ltt and rel_existence_lock) of just one enough ?
| return &rel_pages_base; | ||
|
|
||
| return getPagesInternal(tdbb, tran, allocPages); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIU, getPages() for LTT should return rel_pages_base - as DFW/make_ltt_version() uses getBasePages() for newly created relation.
| inline bool jrd_rel::isTemporary() const noexcept | ||
| { | ||
| return (rel_flags & (REL_temp_tran | REL_temp_conn)); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add also isLTT() or isLocalTemporary() ?
No description provided.