PostgreSQL的学习心得和知识总结(一百四十九)|psql 的使用技巧:设置、预设、回显和已保存的查询


注:提前言明 本文借鉴了以下博主、书籍或网站的内容,其列表如下:

1、参考书籍:《PostgreSQL数据库内核分析》
2、参考书籍:《数据库事务处理的艺术:事务管理与并发控制》
3、PostgreSQL数据库仓库链接,点击前往
4、日本著名PostgreSQL数据库专家 铃木启修 网站主页,点击前往
5、参考书籍:《PostgreSQL中文手册》
6、参考书籍:《PostgreSQL指南:内幕探索》,点击前往
7、参考书籍:《事务处理 概念与技术》
8、Magic Tricks for Postgres psql: Settings, Presets, Echo, and Saved Queries,点击前往


1、本文内容全部来源于开源社区 GitHub和以上博主的贡献,本文也免费开源(可能会存在问题,评论区等待大佬们的指正)
2、本文目的:开源共享 抛砖引玉 一起学习
3、本文不提供任何资源 不存在任何交易 与任何组织和机构无关
4、大家可以根据需要自行 复制粘贴以及作为其他个人用途,但是不允许转载 不允许商用 (写作不易,还请见谅 💖)
5、本文内容基于PostgreSQL master源码开发而成


psql 的使用技巧:设置、预设、回显和已保存的查询

  • 文章快速说明索引
  • 功能使用背景说明
  • 一些最有用的 psql 命令
    • 格式化 psql 输出
    • psql 输出中的表格列边框
    • 在 psql 中显示查询运行时间
    • 在 psql 中为空值创建预设
    • 您的 psql 历史记录
    • 将 PSQL 命令回显为 SQL
    • 回显所有 Postgres psql 查询
    • 使用 .psqlrc 设置您的默认 psql 体验
    • 自定义提示行
    • 保存在 psqlrc 文件中的查询
  • 尝试使用 psql 环境



文章快速说明索引

学习目标:

做数据库内核开发久了就会有一种 少年得志,年少轻狂 的错觉,然鹅细细一品觉得自己其实不算特别优秀 远远没有达到自己想要的。也许光鲜的表面掩盖了空洞的内在,每每想到于此,皆有夜半临渊如履薄冰之感。为了睡上几个踏实觉,即日起 暂缓其他基于PostgreSQL数据库的兼容功能开发,近段时间 将着重于学习分享Postgres的基础知识和实践内幕。


学习内容:(详见目录)

1、psql 的使用技巧:设置、预设、回显和已保存的查询


学习时间:

2024年07月23日 20:19:05


学习产出:

1、PostgreSQL数据库基础知识回顾 1个
2、CSDN 技术博客 1篇
3、PostgreSQL数据库内核深入学习


注:下面我们所有的学习环境是Centos8+PostgreSQL master +Oracle19C+MySQL8.0

postgres=# select version();version                                                   
------------------------------------------------------------------------------------------------------------PostgreSQL 18devel on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-21), 64-bit
(1 row)postgres=##-----------------------------------------------------------------------------#SQL> select * from v$version;          BANNER        Oracle Database 19c EE Extreme Perf Release 19.0.0.0.0 - Production	
BANNER_FULL	  Oracle Database 19c EE Extreme Perf Release 19.0.0.0.0 - Production Version 19.17.0.0.0	
BANNER_LEGACY Oracle Database 19c EE Extreme Perf Release 19.0.0.0.0 - Production	
CON_ID 0#-----------------------------------------------------------------------------#mysql> select version();
+-----------+
| version() |
+-----------+
| 8.0.27    |
+-----------+
1 row in set (0.06 sec)mysql>

功能使用背景说明

在我使用 Postgres psql cli 的过程中,我从 Crunchy Data 的同事那里学到了一些好习惯,这些习惯让我的终端数据库环境更易于使用。我想分享一些我发现的我最喜欢的东西,它们可以让 Postgres 变得更好。如果您刚刚开始使用 psql,或者还没有尝试太多默认设置,那么这篇文章就是为您准备的。我将带您了解一些最友好的 psql 设置以及如何创建您自己的预设设置文件。

一些最有用的 psql 命令

格式化 psql 输出

Postgres 具有扩展显示模式,它将以列和数据批次的形式读取查询结果,而不是以向右扩展显示的大量列列表的形式读取。

扩展显示示例如下所示:

-[ RECORD 1 ]------------------------------
id         | 1
name       | Alice Johnson
position   | Manager
department | Sales
salary     | 75000.00
-[ RECORD 2 ]------------------------------
id         | 2
name       | Bob Smith
position   | Developer
department | Engineering
salary     | 65000.00
--Automatically format expanded display for wide columns
\x auto

如果您刚刚开始并想尝试这些命令,我​​有一个关于使用基本 psql 的教程。


psql 输出中的表格列边框

如果您不使用扩展显示,您可以让 psql 使用 \pset linestyle来制作一些精美的列轮廓。

--Outline table borders and separators using Unicode characters
\pset linestyle unicode

这将获得如下查询输出:

[postgres@localhost:~/test/bin]$ ./psql 
psql (18devel)
Type "help" for help.postgres=# \pset 
border                   1
columns                  0
csv_fieldsep             ','
expanded                 off
fieldsep                 '|'
fieldsep_zero            off
footer                   on
format                   aligned
linestyle                ascii
null                     ''
numericlocale            off
pager                    1
pager_min_lines          0
recordsep                '\n'
recordsep_zero           off
tableattr                
title                    
tuples_only              off
unicode_border_linestyle single
unicode_column_linestyle single
unicode_header_linestyle single
xheader_width            full
postgres=# 
postgres=# select * from t1;id |    name    
----+------------1 | Oracle2 | MySQL3 | PostgreSQL
(3 rows)postgres=# \pset border 2
Border style is 2.
postgres=# select * from t1;
+----+------------+
| id |    name    |
+----+------------+
|  1 | Oracle     |
|  2 | MySQL      |
|  3 | PostgreSQL |
+----+------------+
(3 rows)postgres=# \pset linestyle unicode
Line style is unicode.
postgres=# select * from t1;
┌────┬────────────┐
│ id │    name    │
├────┼────────────┤
│  1 │ Oracle     │
│  2 │ MySQL      │
│  3 │ PostgreSQL │
└────┴────────────┘
(3 rows)postgres=#

在 psql 中显示查询运行时间

这将在底部为您提供查询运行时间(以毫秒为单位)的结果:

-- Always show query time
\timing

在 psql 中为空值创建预设

这将适用于表情符号或任何兼容 utf-8 的内容:

-- Set Null char output to differentiate it from empty string
\pset null '☘️'
postgres=# select null;
┌──────────┐
│ ?column? │
├──────────┤
│          │
└──────────┘
(1 row)postgres=# \pset null '☘️'
Null display is "☘️".
postgres=# 
postgres=# select null;
┌──────────┐
│ ?column? │
├──────────┤
│ ☘️        │
└──────────┘
(1 row)postgres=#

您的 psql 历史记录

您可以为您的 psql 命令会话创建历史记录文件,如下所示:

-- Creates a history file for each database in your config directory CHECK IF THIS IS RIGHT
\set HISTFILE ~/.config/psql/psql_history-:DBNAME-- Number of commands to save in history
\set HISTSIZE 2000

若是没有设置,如下:

[postgres@localhost:~]$ find . -name *psql_history*
./.psql_history
[postgres@localhost:~]$ 
[postgres@localhost:~]$ head -n 5 ./.psql_history
create table t2 (id int,id2 posint);
select create_distributed_table('t2', 'id');
\d
drop domain posint cascade;
drop table t1;
[postgres@localhost:~]$

将 PSQL 命令回显为 SQL

任何 psql 斜线命令(例如 \d)都会针对 Postgres 的系统表运行。您可以使用 psql echo 命令显示给定命令使用的查询,这可以让您深入了解 Postgres 的内部表、目录和其他命名约定。

-- output any SQL run by psql slash commands
\set ECHO_HIDDEN on-- short name of ECHO_HIDDEN on
-E

现在让 echo 显示一些东西。使用以下命令进行表查找:

\dt+

现在您将看到它向您回显了用于获取该数据的查询,并且在底部显示了 \dt+ 的正常结果:

[postgres@localhost:~/test/bin]$ ./psql -E
psql (18devel)
Type "help" for help.postgres=# \d+
/******** QUERY *********/
SELECT n.nspname as "Schema",c.relname as "Name",CASE c.relkind WHEN 'r' THEN 'table' WHEN 'v' THEN 'view' WHEN 'm' THEN 'materialized view' WHEN 'i' THEN 'index' WHEN 'S' THEN 'sequence' WHEN 't' THEN 'TOAST table' WHEN 'f' THEN 'foreign table' WHEN 'p' THEN 'partitioned table' WHEN 'I' THEN 'partitioned index' END as "Type",pg_catalog.pg_get_userbyid(c.relowner) as "Owner",CASE c.relpersistence WHEN 'p' THEN 'permanent' WHEN 't' THEN 'temporary' WHEN 'u' THEN 'unlogged' END as "Persistence",am.amname as "Access method",pg_catalog.pg_size_pretty(pg_catalog.pg_table_size(c.oid)) as "Size",pg_catalog.obj_description(c.oid, 'pg_class') as "Description"
FROM pg_catalog.pg_class cLEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespaceLEFT JOIN pg_catalog.pg_am am ON am.oid = c.relam
WHERE c.relkind IN ('r','p','v','m','S','f','')AND n.nspname <> 'pg_catalog'AND n.nspname !~ '^pg_toast'AND n.nspname <> 'information_schema'AND pg_catalog.pg_table_is_visible(c.oid)
ORDER BY 1,2;
/************************/List of relationsSchema | Name | Type  |  Owner   | Persistence | Access method | Size  | Description 
--------+------+-------+----------+-------------+---------------+-------+-------------public | t1   | table | postgres | permanent   | heap          | 16 kB | 
(1 row)postgres=#

这块功能的源码解析可以查看本人之前的博客:

  • PostgreSQL的学习心得和知识总结(一百四十)|深入理解PostgreSQL数据库 psql工具 \set 变量内部及HOOK机制,点击前往

回显所有 Postgres psql 查询

您还可以让 psql 回显其运行的所有查询:

-- Have psql echo back queries
\set ECHO queries-- Short name of echo queries
-e
[postgres@localhost:~/test/bin]$ ./psql -e
psql (18devel)
Type "help" for help.postgres=# \dList of relationsSchema | Name | Type  |  Owner   
--------+------+-------+----------public | t1   | table | postgres
(1 row)postgres=# select * from t1;
select * from t1;id |    name    
----+------------1 | Oracle2 | MySQL3 | PostgreSQL
(3 rows)postgres=# \q
[postgres@localhost:~/test/bin]$ ./psql -e -E
psql (18devel)
Type "help" for help.postgres=# \d
/******** QUERY *********/
SELECT n.nspname as "Schema",c.relname as "Name",CASE c.relkind WHEN 'r' THEN 'table' WHEN 'v' THEN 'view' WHEN 'm' THEN 'materialized view' WHEN 'i' THEN 'index' WHEN 'S' THEN 'sequence' WHEN 't' THEN 'TOAST table' WHEN 'f' THEN 'foreign table' WHEN 'p' THEN 'partitioned table' WHEN 'I' THEN 'partitioned index' END as "Type",pg_catalog.pg_get_userbyid(c.relowner) as "Owner"
FROM pg_catalog.pg_class cLEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespaceLEFT JOIN pg_catalog.pg_am am ON am.oid = c.relam
WHERE c.relkind IN ('r','p','v','m','S','f','')AND n.nspname <> 'pg_catalog'AND n.nspname !~ '^pg_toast'AND n.nspname <> 'information_schema'AND pg_catalog.pg_table_is_visible(c.oid)
ORDER BY 1,2;
/************************/List of relationsSchema | Name | Type  |  Owner   
--------+------+-------+----------public | t1   | table | postgres
(1 row)postgres=# select * from t1;
select * from t1;id |    name    
----+------------1 | Oracle2 | MySQL3 | PostgreSQL
(3 rows)postgres=#

如果您正在从文件运行查询,或者它们是 psqlrc 中的预设,并且希望查询第二次输出以进行记录保存,那么这将非常有用。

如果您想进一步了解其中任何一个,我有一个关于 ECHO HIDDEN 和 ECHO 查询的基于网络的教程。


使用 .psqlrc 设置您的默认 psql 体验

我列出的所有上述事项都可以设置为每次使用本地 psql 时自动发生。当 psql 启动时,它会查找 .psqlrc 文件,如果存在,它将执行其中的命令。这允许您自定义提示和其他 psql 设置。

您可以使用以下命令查看您是否有 .psqlrc 文件:

ls -l ~/.psqlrc

如果您想在启动 psql 时跳过命令记录,您可以将这些命令添加到文件的开头和结尾:

-- Don't log these commands at the beginning of the file
\set QUIET 1-- Reset command logging at the end of the file
\set QUIET 0

自定义提示行

psql 的默认提示行只显示数据库名称,没有其他信息。在 psqlrc 文件中,您可以更改 psql 提示行以使用有关数据库主机和会话的不同信息组合。我个人喜欢在这里使用日期和时间,因为我要保存会话以供以后参考。

-- Create a prompt with host, database name, date, and time
\set PROMPT1 '%m@%/ %`date "+%Y-%m-%d %H:%M:%S"` '

或者,如下:

[postgres@localhost:~/test/bin]$ cat ~/.psqlrc
\set PROMPT1 '%m@%n-%/-%> %`date "+%Y-%m-%d %H:%M:%S"` =%# '
[postgres@localhost:~/test/bin]$ 
[postgres@localhost:~/test/bin]$ ./psql
psql (18devel)
Type "help" for help.[local]@postgres-postgres-5432 2024-07-24 00:22:26 =# select * from t1;id |    name    
----+------------1 | Oracle2 | MySQL3 | PostgreSQL
(3 rows)[local]@postgres-postgres-5432 2024-07-24 00:22:33 =# exit
[postgres@localhost:~/test/bin]$
// src/bin/psql/prompt.c/*--------------------------* get_prompt** Returns a statically allocated prompt made by interpolating certain* tcsh style escape sequences into pset.vars "PROMPT1|2|3".* (might not be completely multibyte safe)** Defined interpolations are:* %M - database server "hostname.domainname", "[local]" for AF_UNIX*		sockets, "[local:/dir/name]" if not default* %m - like %M, but hostname only (before first dot), or always "[local]"* %p - backend pid* %> - database server port number* %n - database user name* %/ - current database* %~ - like %/ but "~" when database name equals user name* %w - whitespace of the same width as the most recent output of PROMPT1* %# - "#" if superuser, ">" otherwise* %R - in prompt1 normally =, or ^ if single line mode,*			or a ! if session is not connected to a database;*		in prompt2 -, *, ', or ";*		in prompt3 nothing* %x - transaction status: empty, *, !, ? (unknown or no connection)* %l - The line number inside the current statement, starting from 1.* %? - the error code of the last query (not yet implemented)* %% - a percent sign** %[0-9]		   - the character with the given decimal code* %0[0-7]		   - the character with the given octal code* %0x[0-9A-Fa-f]  - the character with the given hexadecimal code** %`command`	   - The result of executing command in /bin/sh with trailing*					 newline stripped.* %:name:		   - The value of the psql variable 'name'* (those will not be rescanned for more escape sequences!)** %[ ... %]	   - tell readline that the contained text is invisible** If the application-wide prompts become NULL somehow, the returned string* will be empty (not NULL!).*--------------------------*/char *
get_prompt(promptStatus_t status, ConditionalStack cstack);

保存在 psqlrc 文件中的查询

这个 .psqlrc 文件看起来很酷,对吧?但等等……还有更多!您可以将查询添加到此文件,以便只需使用非常简单的 psql 输入即可运行它们。

将这些示例查询添加到 psqlrc,用于长时间运行的查询、缓存命中率、unused_indexes 和表大小。

\set long_running 'SELECT pid, now() - pg_stat_activity.xact_start AS duration, query, state FROM pg_stat_activity WHERE (now() - pg_stat_activity.xact_start) > interval ''5 minutes'' ORDER by 2 DESC;'\set cache_hit 'SELECT ''index hit rate'' AS name, (sum(idx_blks_hit)) / nullif(sum(idx_blks_hit + idx_blks_read),0) AS ratio FROM pg_statio_user_indexes UNION ALL SELECT ''table hit rate'' AS name, sum(heap_blks_hit) / nullif(sum(heap_blks_hit) + sum(heap_blks_read),0) AS ratio FROM pg_statio_user_tables;'\set unused_indexes 'SELECT schemaname || ''.'' || relname AS table, indexrelname AS index, pg_size_pretty(pg_relation_size(i.indexrelid)) AS index_size, idx_scan as index_scans FROM pg_stat_user_indexes ui JOIN pg_index i ON ui.indexrelid = i.indexrelid WHERE NOT indisunique AND idx_scan < 50 AND pg_relation_size(relid) > 5 * 8192 ORDER BY pg_relation_size(i.indexrelid) / nullif(idx_scan, 0) DESC NULLS FIRST, pg_relation_size(i.indexrelid) DESC;'\set table_sizes 'SELECT c.relname AS name, pg_size_pretty(pg_table_size(c.oid)) AS size FROM pg_class c LEFT JOIN pg_namespace n ON (n.oid = c.relnamespace) WHERE n.nspname NOT IN (''pg_catalog'', ''information_schema'') AND n.nspname !~ ''^pg_toast'' AND c.relkind=''r'' ORDER BY pg_table_size(c.oid) DESC;'

案例,如下:

[postgres@localhost:~/test/bin]$ ./psql
psql (18devel)
Type "help" for help.[local]@postgres-postgres-5432 2024-07-24 00:28:24 =# :table_sizes;name | size  
------+-------t1   | 16 kB
(1 row)[local]@postgres-postgres-5432 2024-07-24 00:28:27 =#

尝试使用 psql 环境

我们希望这些内容能给您一些关于尝试使用 psql 环境的想法。这非常简单而且很有趣!成功秘诀:

  • 优先帮助自己处理每天使用但需要花费时间的事情。您是否每周在数据库上运行一次查询?将其放入 psqlrc 文件中,以便下次使用时可以立即找到。
  • 如果您远程连接到数据库,请不要太过分。如果您不使用本地连接到数据库并直接远程连接,请不要创建大量特殊工具,因为使用不同的环境可能会很麻烦。
  • 查看我们的基本 psql 和 ECHO HIDDEN 和 ECHO 查询教程,以便在 Web 浏览器中尝试这些内容

我们的 Postgres 提示页面中还有大量其他方便的 psql 技巧。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/diannao/49933.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Harmony Next -- 图片选择库:宫格展示、全屏预览

hm_image_select_view OpenHarmony三方库中心仓&#xff1a;https://ohpm.openharmony.cn/#/cn/detail/image_select_view 介绍 Harmony Next 图片选择库&#xff0c;可设置最大选择数量、单行显示数量、横向竖向间隔&#xff1b;点击图片后全屏预览 软件架构 Harmony nex…

【国产化信创平台】Unity在Linux系统下的开发知识点和踩坑记录~持续更新~

目录 一、日常踩坑 1.渲染管线HDRP在Linux系统下运行异常&#xff08;不支持&#xff1f;未解决&#xff09; 二、开发知识点 1.IO读写路径的方式 三、常用终端快捷指令 一、日常踩坑 1.渲染管线HDRP在Linux系统下运行异常&#xff08;不支持&#xff1f;未解决&#xff…

什么是STP环路保护

在运行生成树协议的网络中&#xff0c;根端口和其他阻塞端口状态是依靠不断接收来自上游设备的BPDU维持。当由于链路拥塞或者单向链路故障导致这些端口收不到来自上游交换设备的BPDU时&#xff0c;设备会重新选择根端口。原先的根端口会转变为指定端口&#xff0c;而原先的阻塞…

2024年NVIDIA A800最新的价格是多少?

英伟达&#xff08;NVIDIA&#xff09;的A800作为一款专为深度学习应用设计的GPU芯片&#xff0c;自发布以来便受到了市场的广泛关注。其价格在不同时间段和销售渠道中有所波动&#xff0c;但总体而言&#xff0c;A800的售价较为高昂&#xff0c;远超普通消费级显卡。 一、价格…

5 Go语言的值与指针

本专栏将从基础开始&#xff0c;循序渐进&#xff0c;由浅入深讲解Go语言&#xff0c;希望大家都能够从中有所收获&#xff0c;也请大家多多支持。 查看相关资料与知识库 专栏地址:Go专栏 如果文章知识点有错误的地方&#xff0c;请指正&#xff01;大家一起学习&#xff0c;…

(leetcode学习)110. 平衡二叉树

给定一个二叉树&#xff0c;判断它是否是 平衡二叉树 示例 1&#xff1a; 输入&#xff1a;root [3,9,20,null,null,15,7] 输出&#xff1a;true示例 2&#xff1a; 输入&#xff1a;root [1,2,2,3,3,null,null,4,4] 输出&#xff1a;false示例 3&#xff1a; 输入&#xff1…

AI大模型的革命:解析全球主流AI大模型及其对比分析

在人工智能领域&#xff0c;AI大模型的发展正在改变我们的世界。无论是自然语言处理、图像识别&#xff0c;还是自动驾驶和医疗诊断&#xff0c;AI大模型都展示出其强大的潜力和广泛的应用前景。本文将介绍当前世界上主流的AI大模型&#xff0c;并对各个模型做详细介绍和横向对…

stm32入门-----TIM定时器(PWM输出比较——下)

目录 前言 一、硬件元器件介绍 1.舵机 2.直流电机驱动 二、C语言编程步骤 1.开启时钟 2.配置输出的GPIO口 3.配置时基单元 4.初始化输出比较通道 5.开启定时器 三、实践项目 1.PWM驱动LED呼吸灯 2.PWM驱动舵机 3.PWM驱动直流电机 前言 本期我们就开始去进行TIM定时…

802.11 wireshark 抓包

80211 wireshark 抓包 前言配置 monitor软件配置wireshark 操作 前言 本人习惯使用 Omnipeek 抓包分析&#xff0c;所以 wireshark 的实验只讲到抓包完成。 Windows 环境采用 wireshark 抓包是比较麻烦的&#xff0c;因为支持在 Windows 环境中支持抓包的网卡并不多&#xff0…

Oracle数据库 v$archived_log

v$archived_log详解 V$ARCHIVED_LOG视图描述了系统中已经归档的日志文件的相关信息。归档日志是ARCHIVELOG模式的一种&#xff0c;用来记录DML以及DDL对数据库中对象所做的更改&#xff0c;保护数据库以及实施重做数据库恢复。 V$ARCHIVED_LOG视图的主要用途是查看已经归档的…

Html review1

1、块元素和行内元素 块元素独占一行 p、h 行内元素的宽度是内容撑起来的&#xff0c;几个行内可以在一行a、strong、em 2、视频音频播放 视频&#xff1a; video src" 资源 路径" controls进度条 autoplay自动播放 音频&#xff1a; audio src“资源路径” controls…

探索 IT 领域的新宠儿:量子计算

目录 引言&#xff1a;从经典到量子的飞跃 量子计算的基本概念 量子计算的独特优势 量子计算的深度剖析 量子计算的最新进展 量子计算的行业应用前景 面临的挑战与未来展望 结语&#xff1a;迎接量子计算的新时代 引言&#xff1a;从经典到量子的飞跃 在信息技术飞速发…

Springboot 开发之 RestTemplate 简介

一、什么是RestTemplate RestTemplate 是Spring框架提供的一个用于应用中调用REST服务的类。它简化了与HTTP服务的通信&#xff0c;统一了RESTFul的标准&#xff0c;并封装了HTTP连接&#xff0c;我们只需要传入URL及其返回值类型即可。RestTemplate的设计原则与许多其他Sprin…

Linux没有telnet 如何测试对端的端口状态

前段时间有人问uos没有telnet&#xff0c;又找不到包。 追问了一下为什么非要安装telnet&#xff0c;答复是要测试对端的端口号。 这里简单介绍一下&#xff0c;测试端口号的方法有很多&#xff0c;telent只是在windows上经常使用&#xff0c;linux已很少安装并使用该命令&…

SQL Server 数据备份与恢复

引言 数据备份和恢复是数据库管理中至关重要的一部分。确保数据的安全和可恢复性&#xff0c;可以避免由于数据丢失或损坏而带来的重大损失。本文将介绍 SQL Server 数据备份与恢复的基本概念、类型、以及如何执行这些操作。 1. SQL Server 备份类型 SQL Server 提供了多种备…

java找不到符号解决办法

一、java找不到符号 如果你的代码里没有报错&#xff0c;明明是存在的。但是java报错找不到符号。如下所示&#xff0c; 二、解决步骤 1.清除编码工具缓存 本人用的idea&#xff0c; eclipse清除缓存方式有需要的可以百度一下&#xff01; 2.如果是mavne项目的 先clean 再…

19. 填坑Ⅱ

Description emmm&#xff0c;还是北湖深坑&#xff0c;不用惊喜&#xff0c;不用意外。我们继续用石头填&#xff01; 北湖的地面依旧是一维的&#xff0c;每一块宽度都为1&#xff0c;高度是非负整数&#xff0c;用一个数组来表示。 还是提供不限量的 1 * 2 规格的石头。 …

Redis流量分析

Redis流量分析是指对Redis数据库的网络通信量和内部操作进行监控和分析的过程。这有助于理解Redis服务器的负载、性能瓶颈、以及可能存在的问题&#xff0c;以便进行优化和故障排查。以下是一些主要的分析方面&#xff1a; 网络流量监控&#xff1a; 监控进入和离开Redis服务器…

本地连接远程阿里云K8S

1.首先安装kubectl 1.1验证自己系统 uname -m 1.2 按照步骤安装 在 Linux 系统中安装并设置 kubectl | Kubernetes 1.3 阿里云配置 通过kubectl连接Kubernetes集群_容器服务 Kubernetes 版 ACK(ACK)-阿里云帮助中心 2.验证 阿里云config直接导出&#xff0c;直接扔到.…

vue字段判断是否可以鼠标悬浮或者点击跳转

通过字段判断是否可以鼠标悬浮展示颜色 是否点击 <span :class"[converBond.stkindustry ! null ? hoverSpan:,]"click"converBond.stkindustry ! null ?goToIndustry(converBond.stkindustryname,converBond.stkindustry):false">{{converBon…