GPDB管理员笔记(二)管理数据
并发访问控制与事务型数据库系统通过锁机制来控制并发访问的机制不同,GPDB(与PostgreSQL 一样)使用多版本控制(Multiversion Concurrency Control/MVCC)保证数据一致性。这 意味着在查询数据库时,每个事务看到的只是数据的快照,其确保当前的事务不会 看到其
并发访问控制 与事务型数据库系统通过锁机制来控制并发访问的机制不同,GPDB(与PostgreSQL一样)使用多版本控制(Multiversion Concurrency Control/MVCC)保证数据一致性。这
意味着在查询数据库时,每个事务看到的只是数据的快照,其确保当前的事务不会
看到其他事务在相同记录上的修改。据此为数据库的每个事务提供事务隔离。
MVCC以避免给数据库事务显式锁定的方式,最大化减少锁争用以确保多用户环境
下的性能。在并发控制方面,使用MVCC而不是使用锁机制的最大优势是,MVCC对
查询(读)的锁与写的锁不存在冲突,并且读与写之间从不互相阻塞。
空间回收 libo=# vacuum test;
VACUUM VACUUM命令还会收集表级别的统计信息,如记录数、占用磁盘页面数,所以在
装载数据之后对全表执行VACUUM是有必要的,这同样适用AO表
查询分析: libo=# explain select * from t where id=1;
QUERY PLAN
----------------------------------------------------------------------------
Gather Motion 1:1 (slice1; segments: 1) (cost=0.00..1.01 rows=1 width=8)
-> Seq Scan on t (cost=0.00..1.01 rows=1 width=8)
Filter: id = 1
(3 rows)
libo=# vacuum t;
VACUUM
libo=# explain select * from t where id=1;
QUERY PLAN
----------------------------------------------------------------------------
Gather Motion 1:1 (slice1; segments: 1) (cost=0.00..3.04 rows=3 width=8)
-> Seq Scan on t (cost=0.00..3.04 rows=1 width=8)
Filter: id = 1
(3 rows)
libo=#
查询计划分析 若一个查询表现出很差的性能,查看查询计划可能有助于找到问题点。下面是
一些需要查看的东西:
计划中是否有一个操作花费时间超长?查询计划中是否有一个操作花费
了大部分的处理时间?例如,如果一个索引扫描比预期的时间超长,也许
该索引已经处于过期状态,需要考虑重建索引。还可临时尝试使用enable_
之类的参数查看是否可以强制选择不同的计划(可能会更好的效果),这些
参数可以设置特定的查询计划操作为开启或关闭状态。
规划器的评估是否接近实际情况?执行EXPLAIN ANALYZE查看规划器
评估的记录数与真实运行查询操作返回的记录数是否一致。如果差异巨大,
可能需要在TABLE相关的COLUMN上收集更多的统计信息。相关信息可
查看”维护数据库统计信息”章节。
选择性强的条件是否较早出现?选择性强的条件应该被较早应用,从而使
得在计划树中上传的记录更少。如果查询计划在选择性评估方面没有对查
询条件作出正确的判断,可能需要在TABLE相关的COLUMN上收集更多
的统计信息。相关信息可查看”维护数据库统计信息”章节。也可以尝试调
整SQL语句WHERE子句的顺序。
规划器是否选择了最佳的关联顺序?如查询使用多表关联,需要确保规划
器选择了选择性最好的关联顺序。那些可以消除大量记录的关联应在更早
的被执行,从而使得在计划树中上传的记录更少。如果规划器没有选择最
佳的关联顺序,可以尝试设置join_collapse_limit=1并在SQL语句中构造特
定的关联顺序,从而可以强制规划器选择指定的关联顺序。还可以尝试在
TABLE相关的COLUMN上收集更多的统计信息。相关信息可查看”维护数据 据库统计信息”章节。
规划器是否选择性的扫描分区表?如果使用了分区,规划器是否值扫描了
查询条件匹配的相关子表?父表的扫描返回0条记录(本该如此,因为父表
不包含任何数据)。作为显示选择性扫描分区查询计划的例子,参见”验证
分区策略”章节。
规划器是否合适的选择了HASH聚合与HASH关联操作?HASH操作通常
比其他类型的关联和聚合要快。记录在内存中的比较排序比磁盘快。要使
用HASH操作,必须有足够的工作内存用以放置评估的记录。对于特定才
查询可以尝试增加工作内存来查看是否能够获得更好的性能。如果可能,
为该查询执行EXPLAIN ANALYZE,将可以得到哪些操作缓存到磁盘(由
于工作内存不足导致),多少的工作内存被使用,以及需要多少内存以保证
不缓存到磁盘。例如:
Work_mem used: 23430K bytes avg, 23430K bytes max (seg0).
Work_mem wanted: 33649K bytes avg, 33649K bytes max (seg0) to lessen
workfile I/O affecting 2 workers.
需要注意的是wanted信息只是一个提示,基于写出工作文件的量是不精确的。
需要的最小work_mem可能会比提示的值或多或少一些

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



When using Win11 system, sometimes you will encounter a prompt that requires you to enter the administrator username and password. This article will discuss how to deal with this situation. Method 1: 1. Click [Windows Logo], then press [Shift+Restart] to enter safe mode; or enter safe mode this way: click the Start menu and select Settings. Select "Update and Security"; select "Restart Now" in "Recovery"; after restarting and entering the options, select - Troubleshoot - Advanced Options - Startup Settings -&mdash

0.What does this article do? We propose DepthFM: a versatile and fast state-of-the-art generative monocular depth estimation model. In addition to traditional depth estimation tasks, DepthFM also demonstrates state-of-the-art capabilities in downstream tasks such as depth inpainting. DepthFM is efficient and can synthesize depth maps within a few inference steps. Let’s read about this work together ~ 1. Paper information title: DepthFM: FastMonocularDepthEstimationwithFlowMatching Author: MingGui, JohannesS.Fischer, UlrichPrestel, PingchuanMa, Dmytr

Facing lag, slow mobile data connection on iPhone? Typically, the strength of cellular internet on your phone depends on several factors such as region, cellular network type, roaming type, etc. There are some things you can do to get a faster, more reliable cellular Internet connection. Fix 1 – Force Restart iPhone Sometimes, force restarting your device just resets a lot of things, including the cellular connection. Step 1 – Just press the volume up key once and release. Next, press the Volume Down key and release it again. Step 2 – The next part of the process is to hold the button on the right side. Let the iPhone finish restarting. Enable cellular data and check network speed. Check again Fix 2 – Change data mode While 5G offers better network speeds, it works better when the signal is weaker

I cry to death. The world is madly building big models. The data on the Internet is not enough. It is not enough at all. The training model looks like "The Hunger Games", and AI researchers around the world are worrying about how to feed these data voracious eaters. This problem is particularly prominent in multi-modal tasks. At a time when nothing could be done, a start-up team from the Department of Renmin University of China used its own new model to become the first in China to make "model-generated data feed itself" a reality. Moreover, it is a two-pronged approach on the understanding side and the generation side. Both sides can generate high-quality, multi-modal new data and provide data feedback to the model itself. What is a model? Awaker 1.0, a large multi-modal model that just appeared on the Zhongguancun Forum. Who is the team? Sophon engine. Founded by Gao Yizhao, a doctoral student at Renmin University’s Hillhouse School of Artificial Intelligence.

Recently, the military circle has been overwhelmed by the news: US military fighter jets can now complete fully automatic air combat using AI. Yes, just recently, the US military’s AI fighter jet was made public for the first time and the mystery was unveiled. The full name of this fighter is the Variable Stability Simulator Test Aircraft (VISTA). It was personally flown by the Secretary of the US Air Force to simulate a one-on-one air battle. On May 2, U.S. Air Force Secretary Frank Kendall took off in an X-62AVISTA at Edwards Air Force Base. Note that during the one-hour flight, all flight actions were completed autonomously by AI! Kendall said - "For the past few decades, we have been thinking about the unlimited potential of autonomous air-to-air combat, but it has always seemed out of reach." However now,

The latest video of Tesla's robot Optimus is released, and it can already work in the factory. At normal speed, it sorts batteries (Tesla's 4680 batteries) like this: The official also released what it looks like at 20x speed - on a small "workstation", picking and picking and picking: This time it is released One of the highlights of the video is that Optimus completes this work in the factory, completely autonomously, without human intervention throughout the process. And from the perspective of Optimus, it can also pick up and place the crooked battery, focusing on automatic error correction: Regarding Optimus's hand, NVIDIA scientist Jim Fan gave a high evaluation: Optimus's hand is the world's five-fingered robot. One of the most dexterous. Its hands are not only tactile

FP8 and lower floating point quantification precision are no longer the "patent" of H100! Lao Huang wanted everyone to use INT8/INT4, and the Microsoft DeepSpeed team started running FP6 on A100 without official support from NVIDIA. Test results show that the new method TC-FPx's FP6 quantization on A100 is close to or occasionally faster than INT4, and has higher accuracy than the latter. On top of this, there is also end-to-end large model support, which has been open sourced and integrated into deep learning inference frameworks such as DeepSpeed. This result also has an immediate effect on accelerating large models - under this framework, using a single card to run Llama, the throughput is 2.65 times higher than that of dual cards. one

The 2024QS World University Rankings by Subject is here! Overall, there is little change from 2023. According to the official website information, the 2024QS World University Rankings by Subject covers 55 subdivisions and 5 major academic fields. A total of 1,559 universities participated in the ranking, 64 of which are new faces this year (that is, they will not appear in the 2023 ranking). Among these 64 colleges and universities, 14 are truly appearing for the first time. Among them is the University of Chinese Academy of Sciences. According to the refined subjects, Music is a new subject introduced this year. In addition, the data science and artificial intelligence rankings have been expanded, with 51 new universities added to the rankings. The top five in the overall list are: Massachusetts Institute of Technology, University of Cambridge, University of Oxford, and Harvard University
