在我们学习完PG的MVCC机制之后,对于DML操作,被操作的行其实并未被删除,只能手工vacuum或自动vacuum触发才会清理掉这些无效数据,也就是死元组。 基于这种机制,在发生死元组清理动作之前,只需要将其中不可见的行中的数据解析出来,或者发生脏读,就可以获取到误删除的数据。虽然PG不支持脏读,但今天介绍的pg_dirtyread插件,可以实现脏读。 一、安装pg_dirtyread 下载地址 GitHubdf7cb/pg_dirtyread:ReaddeadbutunvacuumedtuplesfromaPostgreSQLrelation 这个网页上有详细的安装说明 编译安装 unz...

在PostgresSQL的数据目录结构中,默认表空间的目录是哪个? A.base B.global C.pg_tblsp D.pg_log 参考答案:A 解析这个题目前,我们先了解下pg中的表空间 一、super用户创建表空间 testdb=selectuser; user ---------- postgres (1row) testdb=CREATETABLESPACEfastspaceLOCATION'/home/postgres/fastspace'; 2023-10-2410:03:59.323CST[114668]LOG:statement:CREATETABLESPACEfa...

关闭数据库时,使用pg_ctl-m参数指定数据库的关闭方式,比较常用的关闭方式是哪种? A.smart B.fast C.immediate D.abort 参考答案:B 解析: 一、解析 通过查看pg_ctl-m帮助手册 Optionsforstoporrestart: -m,--mode=MODEMODEcanbe"smart","fast",or"immediate" Shutdownmodesare: smartquitafterallclientshavedisconnected fastquitdirectly,withpropershutdown(default) imm...

在PostgresSQL中,参数默认的情况下,普通用户最多可建立多少个连接? A.100 B.103 C.97 D.3 参考答案:C 解析 查看PG的默认参数文件 [postgres@ora19c02data]$catpostgresql.conf|grepconnections "postgres-clog_connections=on".Someparameterscanbechangedatruntime max_connections=100(changerequiresrestart) superuser_reserved_connections=3(changerequire...

在PostgresSQL中,表和索引的行数、块数等统计信息记录在哪个系统表中? A.pg_statistic B.pg_proc C.pg_index D.pg_class 参考答案:D 解析: 以一条SQL的查询为例 testdb=selectcount(1)froms1.t1; count ------- 415 (1row) testdb=explainselectcount(1)froms1.t1; QUERYPLAN ----------------------------------------------------------- Aggregate(cost=16.19...

PostgresSQL是否能够自动检测到死锁,然后退出其中一个事务? A.是 B.否 参考答案:A 解析: 模拟死琐 1)准备一张表,插入两条数据 testdb=>selectfroms1.t2; id ----- 111 222 2)窗口1开启事务1 testdb=>begin; BEGIN testdb=>updates1.t2setid=1whereid=111; 3)窗口2开启事务2 testdb=>begin; BEGIN testdb=>updates1.t2setid=2whereid=222; UPDATE1 4)回到窗口1,修改事务...

psql元命令\du和\dg都可以列出角色或用户,请问这两个命令是否等价? A.等价 B.不等价 C.不好说 D.不确定 参考答案:A 解析: 要确认某个封装命令是否等价,只需要看后台调用的SQL即可。 一、开启SQL跟踪功能 1.1修改参数,开启sql跟踪 修改前 log_statement='none'none,ddl,mod,all 修改后 log_statement='all'none,ddl,mod,all 1.2重载使参数生效 [postgres@ora19c02data]$pg_ctlreload-D$PGDATA 二、测试功能 2.1du命令 [postgres@o...

16.ExaminethedescriptionofthePRODUCTDETAILstable: Whichtwostatementsaretrue? A.PRODUCT_NAMEcannotcontainduplicatevalues B.EXPIRY_DATEcontainstheSYSDATEbydefaultifnodateisassignedtoit C.EXPIRY_DATEcannotbeusedinarithmeticexpressions D.PRODUCT_PRICEcanbeusedinanarithmeticexpressionevenifithasnovaluest...

14.ExaminethedescriptionoftheSATES1tableSALES2isatablewiththesamedescriptionasSALES1SomesalesdataiscontainederroneouslyinbothtablesYoumustdisplayrowsfromSALES1andSALES2andwishtoseetheduplicatestooWhichsetoperatorgeneratestherequiredoutput? A.MINUS B.UNIONALL C.SUBTRACT D.UNION E.INTERSECT 参考答案:E 解析:...

关注 更多

空空如也 ~ ~

粉丝 更多

空空如也 ~ ~