当前位置: 首页 > news >正文

(八)PostgreSQL的数据库管理

PostgreSQL的数据库管理

基础信息
OS版本:Red Hat Enterprise Linux Server release 7.9 (Maipo)
DB版本:16.2
pg软件目录:/home/pg16/soft
pg数据目录:/home/pg16/data
端口:5777

1 创建数据库

CREATE DATABASE创建一个新的PostgreSQL数据库。 
若要创建数据库,您必须是超级用户或具有特殊的CREATEDB权限。请参阅CREATE ROLE部分内容。 
默认情况下,将通过克隆系统数据库template1来创建新数据库。也可以通过参数 template 来指定不同的模板。特别是,通过指定TEMPLATE template0,可以创建一个原始数据库(其中不存在用户定义的对象,并且系统对象没有更改),其中只包含PostgreSQL版本预定义的标准对象。这样可以避免复制任何可能已添加到template1中的本地对象。

语法

CREATE DATABASE name
[ WITH ] [ OWNER [=] user_name ]
[ TEMPLATE [=] template ]
[ ENCODING [=] encoding ]
[ STRATEGY [=] strategy ] ]
[ LOCALE [=] locale ]
[ LC_COLLATE [=] lc_collate ]
[ LC_CTYPE [=] lc_ctype ]
[ ICU_LOCALE [=] icu_locale ]
[ ICU_RULES [=] icu_rules ]
[ LOCALE_PROVIDER [=] locale_provider ]
[ COLLATION_VERSION = collation_version ]
[ TABLESPACE [=] tablespace_name ]
[ ALLOW_CONNECTIONS [=] allowconn ]
[ CONNECTION LIMIT [=] connlimit ]
[ IS_TEMPLATE [=] istemplate ]
[ OID [=] oid ]

参数解析

  • name
    The name of a database to create.
    要创建的数据库的名称。

  • user_name
    The role name of the user who will own the new database, or DEFAULT to use the default (namely, the user executing the command). To create a database owned by another role, you must be able to SET ROLE to that role.
    将拥有新数据库的用户的角色名称,或使用默认值的DEFAULT(即执行命令的用户)。若要创建由另一个角色拥有的数据库,您必须能够将角色设置为该角色。

  • template
    The name of the template from which to create the new database, or DEFAULT to use the default template (template1).
    用于创建新数据库的模板的名称,或使用默认模板 template1。

  • encoding
    Character set encoding to use in the new database. Specify a string constant (e.g.,
    ‘SQL_ASCII’), or an integer encoding number, or DEFAULT to use the default encoding (namely, the encoding of the template database). The character sets supported by the PostgreSQL server
    are described in Section 24.3.1. See below for additional restrictions.
    要在新数据库中使用的字符集编码。指定字符串常量(例如“SQL_ASCII”)、整数编码数字或使用默认编码(即模板数据库的编码)。PostgreSQL服务器支持的字符集如第24.3.1节所述。有关其他限制,请参见下文。

  • strategy
    Strategy to be used in creating the new database. If the WAL_LOG strategy is used, the database
    will be copied block by block and each block will be separately written to the write-ahead log.
    This is the most efficient strategy in cases where the template database is small, and therefore it is
    the default. The older FILE_COPY strategy is also available. This strategy writes a small record
    to the write-ahead log for each tablespace used by the target database. Each such record represents copying an entire directory to a new location at the filesystem level. While this does reduce the write-ahead log volume substantially, especially if the template database is large, it also forces the system to perform a checkpoint both before and after the creation of the new database. In some situations, this may have a noticeable negative impact on overall system performance.
    用于创建新数据库的策略。如果使用WAL_LOG策略,数据库将被逐块复制,并且每个块将分别写入预写日志。在模板数据库很小的情况下,这是最有效的策略,因此它是默认的。旧的FILE_COPY策略也可用。此策略为目标数据库使用的每个表空间向预写日志中写入一条小记录。每个这样的记录都表示将整个目录复制到文件系统级别的新位置。虽然这确实大大减少了预写日志量,特别是在模板数据库很大的情况下,但它也迫使系统在创建新数据库之前和之后执行检查点。在某些情况下,这可能会对整个系统性能产生明显的负面影响。

  • locale
    Sets the default collation order and character classification in the new database. Collation affects the sort order applied to strings, e.g., in queries with ORDER BY, as well as the order used in indexes on text columns. Character classification affects the categorization of characters, e.g., lower, upper, and digit. Also sets the associated aspects of the operating system environment, LC_COLLATE and LC_CTYPE. The default is the same setting as the template database. See Section 24.2.2.3.1 and Section 24.2.2.3.2 for details.
    设置新数据库中的默认排序规则顺序和字符分类。排序规则影响应用于字符串的排序顺序,例如,在使用order BY的查询中,以及在文本列的索引中使用的顺序。字符分类会影响字符的分类,例如低位、高位和数字。还设置操作系统环境的相关方面LC_COLLATE和LC_CTYPE。默认设置与模板数据库的设置相同。详见第24.2.2.3.1节和第24.2.2.3.2节。

  • lc_collate
    Sets LC_COLLATE in the database server’s operating system environment. The default is the
    setting of locale if specified, otherwise the same setting as the template database. See below
    for additional restrictions.
    If locale_provider is libc, also sets the default collation order to use in the new database,
    overriding the setting locale.
    在数据库服务器的操作系统环境中设置LC_COLLATE。默认值是区域设置(如果指定),否则与模板数据库的设置相同。有关其他限制,请参见下文。
    如果locale_provider是libc,还将设置要在新数据库中使用的默认排序规则顺序,覆盖设置区域设置。

  • lc_ctype
    Sets LC_CTYPE in the database server’s operating system environment. The default is the setting of locale if specified, otherwise the same setting as the template database. See below for additional restrictions.
    If locale_provider is libc, also sets the default character classification to use in the new database, overriding the setting locale.
    在数据库服务器的操作系统环境中设置LC_CTYPE。默认值是区域设置(如果指定),否则与模板数据库的设置相同。有关其他限制,请参见下文。
    如果locale_provider是libc,还将设置要在新数据库中使用的默认字符分类,从而覆盖设置区域设置。

  • icu_locale
    Specifies the ICU locale (see Section 24.2.2.3.2) for the database default collation order and character classification, overriding the setting locale. The locale provider must be ICU. The default is the setting of locale if specified; otherwise the same setting as the template database.
    为数据库默认排序规则顺序和字符分类指定ICU区域设置(请参见第24.2.2.3.2节),覆盖设置区域设置。区域设置提供程序必须是ICU。如果指定,则默认为区域设置;否则设置与模板数据库相同

  • icu_rules
    Specifies additional collation rules to customize the behavior of the default collation of this database. This is supported for ICU only. See Section 24.2.3.4 for details.
    指定其他排序规则以自定义此数据库的默认排序规则的行为。这仅适用于ICU。详见第24.2.3.4节。

  • locale_provider
    Specifies the provider to use for the default collation in this database. Possible values are icu (if the server was built with ICU support) or libc. By default, the provider is the same as that of
    the template. See Section 24.1.4 for details.
    指定用于此数据库中默认排序规则的提供程序。可能的值是icu(如果服务器是在icu支持下构建的)或libc。默认情况下,提供程序与模板的提供程序相同。详见第24.1.4节。

  • collation_version
    Specifies the collation version string to store with the database. Normally, this should be omitted, which will cause the version to be computed from the actual version of the database collation as provided by the operating system. This option is intended to be used by pg_upgrade for copying the version from an existing installation.
    See also ALTER DATABASE for how to handle database collation version mismatches.
    指定要与数据库一起存储的排序规则版本字符串。通常情况下,应该忽略这一点,这将导致根据操作系统提供的数据库排序规则的实际版本来计算版本。此选项用于pg_upgrade从现有安装中复制版本。
    有关如何处理数据库排序规则版本不匹配的信息,请参阅ALTER DATABASE。

  • tablespace_name
    The name of the tablespace that will be associated with the new database, or DEFAULT to use
    the template database’s tablespace. This tablespace will be the default tablespace used for objects created in this database. See CREATE TABLESPACE for more information.
    将与新数据库相关联的表空间的名称,或默认使用模板数据库表空间。此表空间将是用于在此数据库中创建的对象的默认表空间。有关详细信息,请参见CREATE TABLESPACE。

  • allowconn
    If false then no one can connect to this database. The default is true, allowing connections (except as restricted by other mechanisms, such as GRANT/REVOKE CONNECT).
    如果为false,则没有人可以连接到此数据库。默认值为true,允许连接(除非受到其他机制的限制,如GRANT/REVOKE CONNECT)。

  • connlimit
    How many concurrent connections can be made to this database. -1 (the default) means no limit.
    可以与此数据库建立多少个并发连接-1(默认值)表示没有限制。

  • istemplate
    If true, then this database can be cloned by any user with CREATEDB privileges; if false (the
    default), then only superusers or the owner of the database can clone it.
    如果为true,则任何具有CREATEDB权限的用户都可以克隆此数据库;如果为false(默认值),则只有超级用户或数据库所有者才能克隆它。

  • oid
    The object identifier to be used for the new database. If this parameter is not specified, PostgreSQL will choose a suitable OID automatically. This parameter is primarily intended for internal use by pg_upgrade, and only pg_upgrade can specify a value less than 16384.
    要用于新数据库的对象标识符。如果没有指定这个参数,PostgreSQL会自动选择一个合适的OID。此参数主要供pg_upgrade内部使用,只有pg_upggrade才能指定小于16384的值。

Optional parameters can be written in any order, not only the order illustrated above.
以上可选参数可以按照任何顺序写入,而不仅仅是按照上面所示的顺序。

case 1:创建数据库test1

postgres=# create database test1;
CREATE DATABASE
postgres=# \lList of databasesName    |  Owner   | Encoding | Locale Provider |   Collate   |    Ctype    | ICU Locale | ICU Rules |   Access privileges   
-----------+----------+----------+-----------------+-------------+-------------+------------+-----------+-----------------------postgres  | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | template0 | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | =c/postgres          +|          |          |                 |             |             |            |           | postgres=CTc/postgrestemplate1 | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | =c/postgres          +|          |          |                 |             |             |            |           | postgres=CTc/postgrestest1     | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | white     | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | 
(5 rows)

case 2:创建数据库test2,并指定表空间。

--创建表空间test1
mkdir -p /pgdir/test1
chown -R pg16:pg16  /pgdir/test1[pg16@test test1]$ psql -p 5777
psql (16.2)
Type "help" for help.postgres=# CREATE TABLESPACE test1 LOCATION '/pgdir/test1';
CREATE TABLESPACE
postgres=# \dbList of tablespacesName    |  Owner   |   Location   
------------+----------+--------------pg_default | postgres | pg_global  | postgres | test1      | postgres | /pgdir/test1
(3 rows)

–创建数据库test2

postgres=# create database test2 tablespace test1;
CREATE DATABASE
postgres=# \lList of databasesName    |  Owner   | Encoding | Locale Provider |   Collate   |    Ctype    | ICU Locale | ICU Rules |   Access privileges   
-----------+----------+----------+-----------------+-------------+-------------+------------+-----------+-----------------------postgres  | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | template0 | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | =c/postgres          +|          |          |                 |             |             |            |           | postgres=CTc/postgrestemplate1 | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | =c/postgres          +|          |          |                 |             |             |            |           | postgres=CTc/postgrestest1     | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | test2     | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | white     | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | 
(6 rows)postgres=# select b.datname,a.spcname from pg_tablespace a,pg_database b where a.oid=b.dattablespace and b.datname='test2';datname | spcname 
---------+---------test2   | test1
(1 row)

2 修改数据库

语法

ALTER DATABASE name [ [ WITH ] option [ ... ] ]
where option can be:
ALLOW_CONNECTIONS allowconn
CONNECTION LIMIT connlimit
IS_TEMPLATE istemplate
ALTER DATABASE name RENAME TO new_name
ALTER DATABASE name OWNER TO { new_owner | CURRENT_ROLE |
CURRENT_USER | SESSION_USER }
ALTER DATABASE name SET TABLESPACE new_tablespace
ALTER DATABASE name REFRESH COLLATION VERSION
ALTER DATABASE name SET configuration_parameter { TO | = } { value
| DEFAULT }
ALTER DATABASE name SET configuration_parameter FROM CURRENT
ALTER DATABASE name RESET configuration_parameter
ALTER DATABASE name RESET ALL

参数解析

  • name
    The name of the database whose attributes are to be altered.

  • allowconn
    If false then no one can connect to this database.

  • connlimit
    How many concurrent connections can be made to this database. -1 means no limit.

  • istemplate
    If true, then this database can be cloned by any user with CREATEDB privileges; if false, then
    only superusers or the owner of the database can clone it.

  • new_name
    The new name of the database.

  • new_owner
    The new owner of the database.

  • new_tablespace
    The new default tablespace of the database.
    This form of the command cannot be executed inside a transaction block.

  • REFRESH COLLATION VERSION
    Update the database collation version. See Notes for background.

  • configuration_parameter

  • value
    Set this database’s session default for the specified configuration parameter to the given value. Ifvalue is DEFAULT or, equivalently, RESET is used, the database-specific setting is removed,
    so the system-wide default setting will be inherited in new sessions. Use RESET ALL to clear
    all database-specific settings. SET FROM CURRENT saves the session’s current value of the
    parameter as the database-specific value.

case 1:数据库test1的表空间为test1

postgres=# select b.datname,a.spcname from pg_tablespace a,pg_database b where a.oid=b.dattablespace and b.datname='test1';datname |  spcname   
---------+------------test1   | pg_default
(1 row)postgres=# alter database test1 set tablespace test1;
ALTER DATABASE
postgres=# select b.datname,a.spcname from pg_tablespace a,pg_database b where a.oid=b.dattablespace and b.datname='test1';datname | spcname 
---------+---------test1   | test1
(1 row)postgres=# 

case 2:修改数据库test1的名字为test1_new

postgres=# \lList of databasesName    |  Owner   | Encoding | Locale Provider |   Collate   |    Ctype    | ICU Locale | ICU Rules |   Access privileges   
-----------+----------+----------+-----------------+-------------+-------------+------------+-----------+-----------------------postgres  | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | template0 | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | =c/postgres          +|          |          |                 |             |             |            |           | postgres=CTc/postgrestemplate1 | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | =c/postgres          +|          |          |                 |             |             |            |           | postgres=CTc/postgrestest1     | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | test2     | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | white     | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | 
(6 rows)postgres=# alter database test1 rename to test1_new;
ALTER DATABASE
postgres=# \lList of databasesName    |  Owner   | Encoding | Locale Provider |   Collate   |    Ctype    | ICU Locale | ICU Rules |   Access privileges   
-----------+----------+----------+-----------------+-------------+-------------+------------+-----------+-----------------------postgres  | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | template0 | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | =c/postgres          +|          |          |                 |             |             |            |           | postgres=CTc/postgrestemplate1 | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | =c/postgres          +|          |          |                 |             |             |            |           | postgres=CTc/postgrestest1_new | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | test2     | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | white     | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | 
(6 rows)

3 删除数据库

DROP DATABASE删除数据库。它删除数据库的目录条目,并删除包含数据的目录。它只能由数据库所有者执行。当您连接到目标数据库时,它无法执行。(连接到postgres或任何其他数据库以发出此命令。)此外,如果其他任何人连接到目标数据库,则除非使用下面描述的FORCE选项,否则此命令将失败。
DROP DATABASE无法撤消。小心使用!

语法

DROP DATABASE [ IF EXISTS ] name [ [ WITH ] ( option [, ...] ) ]
where option can be:
FORCE

case 1:删除数据库test1

postgres=# \lList of databasesName    |  Owner   | Encoding | Locale Provider |   Collate   |    Ctype    | ICU Locale | ICU Rules |   Access privileges   
-----------+----------+----------+-----------------+-------------+-------------+------------+-----------+-----------------------postgres  | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | template0 | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | =c/postgres          +|          |          |                 |             |             |            |           | postgres=CTc/postgrestemplate1 | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | =c/postgres          +|          |          |                 |             |             |            |           | postgres=CTc/postgrestest1     | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | test2     | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | white     | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | 
(6 rows)postgres=# drop database test1;
DROP DATABASE
postgres=# \lList of databasesName    |  Owner   | Encoding | Locale Provider |   Collate   |    Ctype    | ICU Locale | ICU Rules |   Access privileges   
-----------+----------+----------+-----------------+-------------+-------------+------------+-----------+-----------------------postgres  | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | template0 | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | =c/postgres          +|          |          |                 |             |             |            |           | postgres=CTc/postgrestemplate1 | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | =c/postgres          +|          |          |                 |             |             |            |           | postgres=CTc/postgrestest2     | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | white     | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | 
(5 rows)

case 2:删除数据库test2,加force参数。

postgres=# drop database test2;
ERROR:  database "test2" is being accessed by other users
DETAIL:  There is 1 other session using the database.^
postgres=# drop database test2 with (force);
DROP DATABASE
postgres=# 
postgres=# \lList of databasesName    |  Owner   | Encoding | Locale Provider |   Collate   |    Ctype    | ICU Locale | ICU Rules |   Access privileges   
-----------+----------+----------+-----------------+-------------+-------------+------------+-----------+-----------------------postgres  | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | template0 | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | =c/postgres          +|          |          |                 |             |             |            |           | postgres=CTc/postgrestemplate1 | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | =c/postgres          +|          |          |                 |             |             |            |           | postgres=CTc/postgreswhite     | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | 
(4 rows)postgres=# 

更多内容请查看对应数据库版本的官方文档。

谨记:心存敬畏,行有所止。

相关文章:

(八)PostgreSQL的数据库管理

PostgreSQL的数据库管理 基础信息 OS版本:Red Hat Enterprise Linux Server release 7.9 (Maipo) DB版本:16.2 pg软件目录:/home/pg16/soft pg数据目录:/home/pg16/data 端口:57771 创建数据库 CREATE DATABASE创建一…...

外包干了30天,技术倒退明显

先说情况,大专毕业,18年通过校招进入湖南某软件公司,干了接近6年的功能测试,今年年初,感觉自己不能够在这样下去了,长时间呆在一个舒适的环境会让一个人堕落! 而我已经在一个企业干了四年的功能…...

ruoyi-nbcio-plus基于vue3的flowable的自定义业务单表例子的升级修改

更多ruoyi-nbcio功能请看演示系统 gitee源代码地址 前后端代码: https://gitee.com/nbacheng/ruoyi-nbcio 演示地址:RuoYi-Nbcio后台管理系统 http://122.227.135.243:9666/ 更多nbcio-boot功能请看演示系统 gitee源代码地址 后端代码&#xff1a…...

【ENSP】华为三层交换机配置AAA认证,开启telnet服务

配置步骤 1.给交换机配置ip地址,以便登陆 2.配置AAA,用户名,密码,服务类型,用户权限 3.配置接入设备的数量 4.开启telnet服务 LSW2交换机配置 u t m #关闭提示 sys …...

collections模块下的Counter函数讲解

📚博客主页:knighthood2001 ✨公众号:认知up吧 (目前正在带领大家一起提升认知,感兴趣可以来围观一下) 🎃知识星球:【认知up吧|成长|副业】介绍 ❤️感谢大家点赞👍&…...

HarmonyOS开发实例:【分布式邮件】

概述 基于TS扩展的声明式开发范式编程语言编写的一个分布式邮件系统,可以由一台设备拉起另一台设备,每次改动邮件内容,都会同步更新两台设备的信息。效果图如下: 搭建OpenHarmony开发环境 完成本篇Codelab我们首先要完成开发环境…...

llama2.c与chinese-baby-llama2语言模型本地部署推理

文章目录 简介Github文档克隆源码英文模型编译运行中文模型(280M)main函数 简介 llama2.c是一个极简的Llama 2 LLM全栈工具,使用一个简单的 700 行 C 文件 ( run.c ) 对其进行推理。llama2.c涉及LLM微调、模型构建、推理端末部署&#xff08…...

008、Python+fastapi,第一个后台管理项目走向第8步:ubutun 20.04下安装vscode+python环境配置

一、说明 白飘了3个月无影云电脑,开始选了个windows server 非常不好用,后台改为ubuntu想升级到22,没成功,那就20.04吧。 今天先安装下开发环境,后续2个月就想把他当做开发服务器,不知道行不行,…...

2024.4.16 驱动开发

思维导图...

如何在 Ubuntu 14.04 上更改 PHP 设置

简介 PHP 是一种服务器端脚本语言,被许多流行的 CMS 和博客平台如 WordPress 和 Drupal 所使用。它也是流行的 LAMP 和 LEMP 堆栈的一部分。更新 PHP 配置设置是设置基于 PHP 的网站时的常见任务。定位确切的 PHP 配置文件可能并不容易。通常在服务器上会有多个 PH…...

【光伏企业】光伏项目怎么做才能提高效率?

一、精细化项目管理 项目规划:在项目启动前,进行充分的调研和规划,明确项目的目标、规模、预算和时间表,确保各项资源得到合理分配。 团队建设:组建一支高效、专业的项目团队,确保团队成员具备光伏领域的…...

毕设选51还是stm32?51太简单?

如果你更倾向于挑战和深入学习,STM32可能是更好的选择。如果你希望更专注于底层硬件原理,51可能更适合。我这里有一套嵌入式入门教程,不仅包含了详细的视频讲解,项目实战。如果你渴望学习嵌入式,不妨点个关注&#xff…...

ip addr和ifconfig区别

ip addr和ifconfig都是用于配置和管理网络接口的工具 1. ifconfig ifconfig是较旧的网络配置工具,属于net-tools套件的一部分。 该命令主要用于配置、显示和控制网络接口的参数,如IP地址、子网掩码、广播地址等。 ifconfig命令的功能相对有限&#xff…...

Springboot+Vue项目-基于Java+MySQL的房产销售系统(附源码+演示视频+LW)

大家好!我是程序猿老A,感谢您阅读本文,欢迎一键三连哦。 💞当前专栏:Java毕业设计 精彩专栏推荐👇🏻👇🏻👇🏻 🎀 Python毕业设计 &…...

向量数据库中的向量是什么?

在向量数据库中,向量通常指的是高维空间中的点或方向,它们由一组数值组成,这些数值表示该点在空间中的位置或方向。在机器学习和人工智能领域,向量经常用于表示各种类型的数据,如文本、图像、音频等。 具体来说&#x…...

【重回王座】ChatGPT发布最新模型gpt-4-turbo-2024-04-09

今天,新版GPT-4 Turbo再次在大型模型排行榜上荣登榜首,成功超越了此前领先的Claude 3 Opus。另外,新模型在处理长达64k的上下文时,性能竟能够与旧版在处理26k上下文时的表现相当。 目前GPT-4 Turbo仅限于ChatGPT Plus的用户&…...

NL2SQL基础系列(1):业界顶尖排行榜、权威测评数据集及LLM大模型(Spider vs BIRD)全面对比优劣分析[Text2SQL、Text2DSL]

NL2SQL基础系列(1):业界顶尖排行榜、权威测评数据集及LLM大模型(Spider vs BIRD)全面对比优劣分析[Text2SQL、Text2DSL] Text-to-SQL(或者Text2SQL),顾名思义就是把文本转化为SQL语言,更学术一…...

深度学习基础——计算量、参数量和推理时间

深度学习基础——计算量、参数量和推理时间 在深度学习中,计算量、参数量和推理时间是评估模型性能和效率的重要指标。本文将介绍这三个指标的定义、计算方法以及如何使用Python进行实现和可视化展示,以帮助读者更好地理解和评估深度学习模型。 1. 定义…...

另一棵树的子树

目录 题目 思路 代码1 :相同的树 代码二:解题 注意点 题目 给你两棵二叉树 root 和 subRoot 。检验 root 中是否包含和 subRoot 具有相同结构和节点值的子树。如果存在,返回 true ;否则,返回 false 。 二叉树 tr…...

【hive】单节点搭建hadoop和hive

一、背景 需要使用hive远程debug,尝试使用无hadoop部署hive方式一直失败,无果,还是使用有hadoop方式。最终查看linux内存占用6GB,还在后台运行docker的mysql(bitnami/mysql:8.0),基本满意。 版本选择: &a…...

多模态2025:技术路线“神仙打架”,视频生成冲上云霄

文|魏琳华 编|王一粟 一场大会,聚集了中国多模态大模型的“半壁江山”。 智源大会2025为期两天的论坛中,汇集了学界、创业公司和大厂等三方的热门选手,关于多模态的集中讨论达到了前所未有的热度。其中,…...

python打卡day49

知识点回顾: 通道注意力模块复习空间注意力模块CBAM的定义 作业:尝试对今天的模型检查参数数目,并用tensorboard查看训练过程 import torch import torch.nn as nn# 定义通道注意力 class ChannelAttention(nn.Module):def __init__(self,…...

.Net框架,除了EF还有很多很多......

文章目录 1. 引言2. Dapper2.1 概述与设计原理2.2 核心功能与代码示例基本查询多映射查询存储过程调用 2.3 性能优化原理2.4 适用场景 3. NHibernate3.1 概述与架构设计3.2 映射配置示例Fluent映射XML映射 3.3 查询示例HQL查询Criteria APILINQ提供程序 3.4 高级特性3.5 适用场…...

AtCoder 第409​场初级竞赛 A~E题解

A Conflict 【题目链接】 原题链接:A - Conflict 【考点】 枚举 【题目大意】 找到是否有两人都想要的物品。 【解析】 遍历两端字符串,只有在同时为 o 时输出 Yes 并结束程序,否则输出 No。 【难度】 GESP三级 【代码参考】 #i…...

Qwen3-Embedding-0.6B深度解析:多语言语义检索的轻量级利器

第一章 引言:语义表示的新时代挑战与Qwen3的破局之路 1.1 文本嵌入的核心价值与技术演进 在人工智能领域,文本嵌入技术如同连接自然语言与机器理解的“神经突触”——它将人类语言转化为计算机可计算的语义向量,支撑着搜索引擎、推荐系统、…...

AI编程--插件对比分析:CodeRider、GitHub Copilot及其他

AI编程插件对比分析:CodeRider、GitHub Copilot及其他 随着人工智能技术的快速发展,AI编程插件已成为提升开发者生产力的重要工具。CodeRider和GitHub Copilot作为市场上的领先者,分别以其独特的特性和生态系统吸引了大量开发者。本文将从功…...

多模态大语言模型arxiv论文略读(108)

CROME: Cross-Modal Adapters for Efficient Multimodal LLM ➡️ 论文标题:CROME: Cross-Modal Adapters for Efficient Multimodal LLM ➡️ 论文作者:Sayna Ebrahimi, Sercan O. Arik, Tejas Nama, Tomas Pfister ➡️ 研究机构: Google Cloud AI Re…...

【HarmonyOS 5 开发速记】如何获取用户信息(头像/昵称/手机号)

1.获取 authorizationCode: 2.利用 authorizationCode 获取 accessToken:文档中心 3.获取手机:文档中心 4.获取昵称头像:文档中心 首先创建 request 若要获取手机号,scope必填 phone,permissions 必填 …...

LangChain知识库管理后端接口:数据库操作详解—— 构建本地知识库系统的基础《二》

这段 Python 代码是一个完整的 知识库数据库操作模块,用于对本地知识库系统中的知识库进行增删改查(CRUD)操作。它基于 SQLAlchemy ORM 框架 和一个自定义的装饰器 with_session 实现数据库会话管理。 📘 一、整体功能概述 该模块…...

20个超级好用的 CSS 动画库

分享 20 个最佳 CSS 动画库。 它们中的大多数将生成纯 CSS 代码,而不需要任何外部库。 1.Animate.css 一个开箱即用型的跨浏览器动画库,可供你在项目中使用。 2.Magic Animations CSS3 一组简单的动画,可以包含在你的网页或应用项目中。 3.An…...