当前位置:网站首页>The difference between oracle temporary table and pg temporary table
The difference between oracle temporary table and pg temporary table
2022-08-04 06:06:00 【Big Yellow Cat No. 1】
After joining the job, the master asked to query the difference between the pg temporary table and the oracle global temporary table, as well as the idea of transforming the oracle temporary table to pg, all of which are based on their own practice, and welcome comments and corrections if there are mistakes...
Pg temporary table: The pg temporary table is divided into session-level and transactionallevel.
Session level:Data can be saved throughout the life cycle of the session table, if the current session is ended,Then clear the data in the table and delete the table.During this session, you can directly make changes to the fields and data of the table, and other sessions cannot access the current temporary table.
Transaction level:(1) on commit delete rows: You can create temporary in a session with this commandtable, and change the table fields before and after starting the transaction, You can use the dml statement before the transaction starts, but the content of the table does not change substantially,
(2) On commit drop: It can only be created in a transaction, and the table is automatically deleted after the transaction is ended.
Oracle temp table:span>Oracle temporary tables are divided into session level and transaction level.
Session level:Data can be maintained at the entire session level.
Transaction level:The data in the table will be cleared after commit and rollback
The difference between Pg temporary table and oracle temporary table:
Pg temporary table only exists in the current session, other sessions cannot access the temporary table, and ending the session will delete the temporary table.After the Oracle temporary table is created, although the data between each session is isolated from each other, that is, one session cannot see the data of other sessions, but the defined fields are shared.And the definition of the table will still exist after the session is ended, but the data in the table will be cleared.
Changes to Oracle temporary table fields can only be made when all current sessions do not perform dml operations on the table.If one of the sessions changes the data in the table, the ddl operation is not possible.
Deletion of Oracle temporary table:
Transaction level: Only when all sessions are fully committed can they be deleted.
Session level: All sessions can only be deleted before executing the dml statement on the table.
The idea of oracle temporary table to pg temporary table: first, you need to lock the table so that only the current session can access the temporary table, and you need to release other locks in the table (feelingOracle temporary tables are locked so that the definition of the fields in the table cannot be changed after the data in the field is changed, it is not clear whether there is or what lock is added), and the temporary table should be automatically deleted at the end of the session.(This part is an idea, because it cannot be practically operated for some reasons)
边栏推荐
- WARNING: sql version 9.2, server version 11.0.Some psql features might not work.
- [Deep Learning 21 Days Learning Challenge] 1. My handwriting was successfully recognized by the model - CNN implements mnist handwritten digit recognition model study notes
- NFT市场可二开开源系统
- 多项式回归(PolynomialFeatures)
- 自动化运维工具Ansible(1)基础
- yolov3数据读入(二)
- 攻防世界MISC—MISCall
- 【CV-Learning】卷积神经网络
- The use of the attribute of the use of the animation and ButterKnife
- 网络大作业心得笔记
猜你喜欢

【深度学习21天学习挑战赛】1、我的手写被模型成功识别——CNN实现mnist手写数字识别模型学习笔记

字典特征提取,文本特征提取。

安装dlib踩坑记录,报错:WARNING: pip is configured with locations that require TLS/SSL

CAS与自旋锁、ABA问题

Introduction of linear regression 01 - API use cases

flink问题整理

ReentrantLock(公平锁、非公平锁)可重入锁原理

线性回归02---波士顿房价预测

【深度学习21天学习挑战赛】2、复杂样本分类识别——卷积神经网络(CNN)服装图像分类

双重指针的使用
随机推荐
BUUCTF——MISC(一)
超详细MySQL总结
简单说Q-Q图;stats.probplot(QQ图)
Androd Day02
TensorFlow2 study notes: 4. The first neural network model, iris classification
剑指 Offer 20226/30
SQL练习 2022/7/2
NFT市场开源系统
fill_between in Matplotlib; np.argsort() function
纳米级完全删除MYSQL5.7以及一些吐槽
Android connects to mysql database using okhttp
TensorFlow2 study notes: 6. Overfitting and underfitting, and their mitigation solutions
安卓连接mysql数据库,使用okhttp
thymeleaf中 th:href使用笔记
Kubernetes集群安装
flink-sql所有数据类型
The pipeline mechanism in sklearn
RecyclerView的用法
0, deep learning 21 days learning challenge 】 【 set up learning environment
【CV-Learning】目标检测&实例分割