随笔分类 -  oracle&pg&mysql

oracle&pg&mysql
摘要:#!/usr/bin/env python# _*_ coding: utf-8 _*_import pymysqlimport timedb = pymysql.connect(host='xxxxx',user='xxx',password='xxx',database='__recycle_b 阅读全文
posted @ 2022-12-15 16:23 青空如璃 阅读(60) 评论(0) 推荐(0)
摘要:在Oracle 10g中的回收站(Recycle Bin)功能,可以在特殊情况下发挥保命之功能,比如当你删除一个表空间、一个Schema,可能会误删除的表。 刚好我们的一个子业务(OMS业务)使用了PolarDB自带了这个功能,默认是off的。 如果需要进入实例控制台 参数配置,进入相关的参数进行修 阅读全文
posted @ 2022-11-10 14:52 青空如璃 阅读(174) 评论(0) 推荐(0)
摘要:背景:开发从聚石塔拉数据到我司服务器,如果相关状态有变化,会删除原先保留在我司数据库上的数据,再insert数据。 DELETE FROM trade WHERE tid IN (1700364470286966980, 2947548566741856246, 294877072863932676 阅读全文
posted @ 2022-10-14 09:06 青空如璃 阅读(71) 评论(0) 推荐(0)
摘要:PostgreSQL支持在线创建索引(CREATE INDEX CONCURRENTLY),不堵塞其他会话对被创建索引表的DML(INSERT,UPDATE,DELETE)操作。 PostgreSQL 提供了一个创建索引的高效特性,即“并发索引”。此功能允许我们在关系上创建索引,而不会阻塞读写设施。 阅读全文
posted @ 2022-10-12 10:24 青空如璃 阅读(2032) 评论(0) 推荐(0)
摘要:postgres=# select * from pg_control_system(); pg_control_version | catalog_version_no | system_identifier | pg_control_last_modified + + + 1300 | 2021 阅读全文
posted @ 2022-09-20 16:50 青空如璃 阅读(416) 评论(0) 推荐(0)
摘要:1.下载 https://github.com/Luckyness/passwordcheck.git 2.使用方式 [root@harbor contrib]# cat /data/tools/passwordcheck/README.md # 1.使用方式* 替换目录 ../postgresql 阅读全文
posted @ 2022-09-17 15:35 青空如璃 阅读(954) 评论(0) 推荐(0)
摘要:tt=# create SEQUENCE department_id_seq;CREATE SEQUENCETime: 33.621 mstt=# \ds+ List of relations Schema | Name | Type | Owner | Persistence | Size | D 阅读全文
posted @ 2022-09-14 11:09 青空如璃 阅读(186) 评论(0) 推荐(0)
摘要:在了解三者区别之前, 我们来个实例: tt=# create table t3(a char,b varchar);CREATE TABLETime: 14.543 mstt=# insert into t3 values('aa','bb');ERROR: 22001: value too lon 阅读全文
posted @ 2022-09-13 15:40 青空如璃 阅读(2356) 评论(0) 推荐(0)
摘要:####创建表空间[postgres@harbor ~]$ cd /pgccc/ && mdir mytablespace && sudo chown -R postgres. /pgccc/mytablespace[postgres@harbor pgccc]$ ls -la总用量 4drwxr- 阅读全文
posted @ 2022-09-12 14:47 青空如璃 阅读(300) 评论(0) 推荐(0)
摘要:psql (14.3)Type "help" for help. postgres=# \df+ pg_export_snapshot List of functions Schema | Name | Result data type | Argument data types | Type | 阅读全文
posted @ 2022-09-12 11:37 青空如璃 阅读(168) 评论(0) 推荐(0)
摘要:一、报错: [postgres@dba01 archive]$ pg_ctl -D /data/pg14 startwaiting for server to start....2022-08-18 16:11:43.883 CST [45459] LOG: redirecting log outp 阅读全文
posted @ 2022-08-18 16:22 青空如璃 阅读(440) 评论(0) 推荐(0)
摘要:大部分DBA同学,业务正式上线前,会根据业务使用场景,进行sysbench或TPC-C压力测试。一、TPC-C侧重于OLTPTPC-C是业界常用的一套Benchmark,由TPC委员会制定发布,用于评测数据库的联机交易处理(偏向OLTP能力)。主要涉及10张表,包含了NewOrder(新订单的生成) 阅读全文
posted @ 2022-07-28 18:39 青空如璃 阅读(1282) 评论(0) 推荐(0)
摘要:使用网上的方法 dba@mklmi:~$ sudo su - postgres[sudo] password for dba: su: warning: cannot change directory to /home/postgres: No such file or directory$ ls 阅读全文
posted @ 2022-07-23 11:13 青空如璃 阅读(142) 评论(0) 推荐(0)
摘要:可以参考https://www.modb.pro/db/331381 pg_toast_2619这个表是pg_statistic系统表的toast扩展表,如果PG报错如下: ERROR: unexpected chunk number 1 (expected 0) for toast value 1 阅读全文
posted @ 2022-07-22 16:26 青空如璃 阅读(497) 评论(0) 推荐(0)
摘要:mydb=# select * from car; id | name + 1 | aa 2 | bb 3 | cc 4 | ddd(4 rows)Time: 0.592 msmydb=# select *,ctid,xmin,xmax from car; id | name | ctid | xm 阅读全文
posted @ 2022-07-20 13:57 青空如璃 阅读(45) 评论(0) 推荐(0)
摘要:Session A:mydb=# select * from car; id | name + 1 | aa 2 | bb(2 rows)Time: 0.264 msmydb=# begin;BEGINTime: 0.069 msmydb=*# delete from car;DELETE 2Tim 阅读全文
posted @ 2022-07-18 14:21 青空如璃 阅读(126) 评论(0) 推荐(0)
摘要:postgres=# drop database oms_info;ERROR: database "oms_info" is being accessed by other usersDETAIL: There are 2 other sessions using the database. 上述 阅读全文
posted @ 2022-07-08 18:23 青空如璃 阅读(381) 评论(0) 推荐(0)
摘要:我们使用psql,基本使用\d \dv \ds \l.....等命令查询,下面介绍常用的特例[postgres@dba01 ~]$ psql -hlocalhost -p1921 psql (14.3)Type "help" for help.postgres=# \c mydb;You are n 阅读全文
posted @ 2022-07-04 11:13 青空如璃 阅读(612) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2022-07-01 17:08 青空如璃 阅读(283) 评论(0) 推荐(0)
摘要:一、全表扫描(Seq Scan) 当数据表中没有索引,或者满足条件的数据集较大,索引扫描的成本高于全表扫描,这时规划器会选择使用全表扫描。 二、索引扫描(index scan) 查询列时有索引,则直接扫描索引,不再进行全表扫描,耗费时间小于顺序扫描。 多了筛选条件后,会打开每条记录,进行筛选记录,花 阅读全文
posted @ 2022-07-01 16:45 青空如璃 阅读(2794) 评论(0) 推荐(0)