首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏个人积累

    postgres相关

    #host replication postgres 127.0.0.1/32 md5 #host replication postgres

    1.5K31发布于 2020-10-10
  • 来自专栏roseduan写字的地方

    Postgres 源码学习 2—Postgres 的 VFD 机制

    操作系统中的文件 数据库的本质其实就是用来存储数据的,所以免不了和文件系统、存储进行交互,万丈高楼平地起,存储一般是一个数据库的最底层,Postgres 在存储的文件管理方面也有很多的设计与抽象。 在操作系统层面,提供了一些文件操作相关的系统调用(fopen、fclose、fsync 等),我们作为上层使用者,可以直接通过 C 语言库进行调用即可(Postgres 使用 C 语言编写)。 Postgres 的 VFD 作用 Postgres 数据库在运行的过程当中,可能会打开非常多的文件,比如数据表对应的文件,元数据表文件,以及一些在 SQL 运行时打开的临时文件,例如排序、哈希表所需的文件 VFD 的基本工作方式 Postgres 主要通过一个进程私有的数组来维护 VFD,名为 VfdCache。 通过这种方式,Postgres 可以打开远超过系统和进程限制的文件数量,是一个非常精妙的设计。

    64110编辑于 2024-04-19
  • 来自专栏roseduan写字的地方

    Postgres 源码学习 3—Postgres 存储管理器

    前面一节说到,在 Postgres 的 VFD 机制之上,我们可以避开打开文件数量的系统限制,通过 VFD 可以进行打开、读写、关闭、删除文件等操作,简单来说就是 VFD 为我们提供了一个抽象,屏蔽了操作系统文件描述符的接口 文件类型和文件块 要了解 Postgres 的存储管理,需要先对 Postgres 的表文件的组织方式、类型有一个简单的了解。 Postgres 中的表文件可能会非常大,在物理存储上会将表文件拆分为多个,每一个表文件通过 segno 来区分。 在 Postgres 的数据目录中,表文件的存储格式为 base/<database oid>/

    。 但是目前在操作系统层面,已经提供了文件系统的抽象,所以存储管理器其实已经没有存在的必要了,但是 Postgres 依然选择将其保留,主要是认为这层抽象并没有什么其他的影响。

    61110编辑于 2024-05-30
  • 来自专栏roseduan写字的地方

    Postgres 源码学习 1—Postgres 源码编译和 debug

    su <username> 安装依赖 安装 Postgres 编译所需的依赖(这里是摘取了 Greenplum 的安装依赖,可能包含了一些没必要安装的,但肯定是涵盖了 Postgres 需要的依赖,所以全部安装上也没啥问题 的源代码,并进入到 postgres 代码目录中。 如果是拉取最新版本的代码,可以从 Github 上获取: git clone https://github.com/postgres/postgres.git 如果想要获取对应版本的源代码,则可以从 Postgres 官网中下载: 地址:https://www.postgresql.org/ftp/source/ Postgres 有非常多的编译选项,详情可以参考官方文档:https://www.postgresql.org pg_ctl -D pg-data start 启动之后,可以查看 postgres 的进程状态。

    1.2K11编辑于 2024-04-18
  • 来自专栏DATABASE

    Postgres 源码安装

    id: postgres: no such user [root@Centos ~]# groupadd postgres [root@Centos ~]# useradd -g postgres postgres -rwxr-xr-x. 1 postgres postgres 568656 Feb 9 2021 configure -rw-r--r--. 1 postgres postgres 82388 1 postgres postgres 1192 Feb 9 2021 COPYRIGHT drwxrwxr-x. 3 postgres postgres 87 Feb 9 2021 1 postgres postgres 1665 Feb 9 2021 Makefile -rw-r--r--. 1 postgres postgres 1213 Feb 9 2021 : ~~~bash postgres=# \c postgres You are now connected to database "postgres" as user "postgres". postgres

    2.3K00编辑于 2022-05-21
  • 来自专栏PostgreSQL研究与原理解析

    Oracle转换Postgres

    可以在postgres中创建一个视图作为这个表从而消除上述问题。这样就可以在不干扰Postgres的解析器情况下兼容Oracle的SQL。迁移过程中,尽可能去掉“FROM DUAL”子句。 Postgres的ctid起同样的作用。 序列 Oracle的序列语法是sequence_name.nextval。 Postgres的序列语法是nextval('sequence_name')。 虽然postgres具备大部分功能,但是一些特性还需要等待其新版本发布。 Postgres中,对于空字符串得到的结果是FALSE,而NULL得到的是TRUE。当从Oracle向postgres转换时,需要分析字符代码,分离出NULL和空字符串。 Oracle to postgres:不使用ODBC和其他中间件。转换表结构、数据、索引、主键和外键。

    6.8K00发布于 2020-01-19
  • 来自专栏caoayu的分享

    Deepin 安装Postgres

    postgres 安装完成默认存在一个 postgres 数据库 psql -U postgres -h 127.0.0.1 -p 5432 -d postgres # -U 用户名 -h 连接地址 - p 端口 -d 数据库名 如果连接失败或者说用户不存在则使用 postgres 用户登录 sudo su - postgres # 切换到 postgres 用户 psql # 登录 \password /postgres.sql 使用 postgres 官方源安装 postgres12 首先卸载旧版本或配置错误的版本 sudo apt remove postgresql --purge # purge run -d --name postgres-server -p 5432:5432 -e "POSTGRES_PASSWORD=progres" postgres # --name 容器运行的名称 测试持久化 docker exec -it postgres-server bash su - postgres \c postgres postgres=# create table test1(id

    3.4K20发布于 2020-12-01
  • 来自专栏PostgreSQL研究与原理解析

    Oracle转换Postgres

    可以在postgres中创建一个视图作为这个表从而消除上述问题。这样就可以在不干扰Postgres的解析器情况下兼容Oracle的SQL。迁移过程中,尽可能去掉“FROM DUAL”子句。 Postgres的ctid起同样的作用。 序列 Oracle的序列语法是sequence_name.nextval。 Postgres的序列语法是nextval('sequence_name')。 虽然postgres具备大部分功能,但是一些特性还需要等待其新版本发布。 Postgres中,对于空字符串得到的结果是FALSE,而NULL得到的是TRUE。当从Oracle向postgres转换时,需要分析字符代码,分离出NULL和空字符串。 Oracle to postgres:不使用ODBC和其他中间件。转换表结构、数据、索引、主键和外键。

    9.2K30发布于 2020-10-28
  • 来自专栏soon

    sqlite迁移到postgres

    vim load.test 2.写入以下参数 load database from sqlite://path to/xxx.db 这里是Sqlite地址 into postgres

    2.4K20发布于 2019-02-14
  • 来自专栏有困难要上,没有困难创造困难也要上!

    Postgres容器使用

    下载postgres镜像 $ sudo docker pull postgres 启动postgres容器 $ sudo docker run --name mypostgres -e POSTGRES_PASSWORD =Letmein -d -p 5432:5432 postgres 上面命令会启动一个名为mypostgres的容器,并且设置postgres用户的密码为Letmein。 =Letmein -d -p 5432:5432 -v `pwd`/scripts:/docker-entrypoint-initdb.d postgres 使用命令行连接到postgres数据库 启动一个容器并使用 psql连接到容器 $ sudo docker run -it --rm --link mypostgres postgres psql -h mypostgres -U postgres Password postgres=# \dt postgres=# select 1; 使用nodejs连接到postgres数据库 安装pg库 npm install pg 连接并查询postgres数据库 const

    67210编辑于 2024-09-04
  • 来自专栏geekfly

    Ubuntu安装PostGres 12

    添加用户、创建数据库 切换超管postgres 用户 sudo su - postgrespostgres密码:psql -c "alter user postgres with password 'StrongAdminPassw0rd'" 进入命令行:psql,创建数据库、创建用户、用户和库授权 postgres=# CREATE DATABASE mytestdb; CREATE DATABASE postgres=# CREATE USER mytestuser WITH ENCRYPTED PASSWORD 'MyStr0ngP@SS'; CREATE ROLE postgres=# GRANT

    1.3K10编辑于 2022-07-17
  • 来自专栏.NET开发那点事

    使用Npgsql连接Postgres

    1.装好Postgres 2.开启远程访问 配置postgresql.conf文件 listen_addresses = '*'  配置pg_hba.conf文件 host    all        

    2.9K10编辑于 2022-05-07
  • 来自专栏阿杰

    postgres分区表

    一、特性postgres分区表是数据层层面的, 相对于普通表在内部实现复杂,但是用户无感知.分区表是一种将大表拆分成多个小表的方式Hash 分区:根据特定列的哈希值将数据均匀分布到多个分区中。

    73810编辑于 2024-11-01
  • 来自专栏Postgres World

    迁移Postgres的Sequence(序列)

    序列(Sequence)的当前值(Currval)无法通过pg_dump导出,又不能对源实例做修改,得这么办才行。

    3.8K44发布于 2021-05-18
  • 来自专栏大数据与知识图谱

    Postgres by BigSQL and Hadoop_fdw

    测试环境 Centos6.8 HDP2.4集群,其中Hive Server2位于主机名为hdp的主机上 Postgres by BigSQL(pg96) Installation Steps 由于Postgres initializing PostgreSQL Server 以sudo权限执行下面命令: $ sudo /opt/postgresql/pgc start pg96 Using the Database 加载postgres pg96/pg96.env 查看pg96的状态: $ sudo /opt/postgresql/pgc status 进入数据库: $ /opt/postgresql/pg96/bin/psql -U postgres -d postgres 安装HadoopFDW前需要准备环境 1. values(1, 1.68); hive> select * from test_fdw; OK 1 1.68 进入pg96使用 /opt/postgresql/pg96/bin/psql -U postgres

    1K20编辑于 2022-06-01
  • 来自专栏johnhuster

    ubuntu20.04安装postgres

    (使用psql客户端登录) # sudo -u postgres psql //其中,sudo -u postgres 是使用postgres 用户登录的意思 //PostgreSQL数据默认会创建一个postgres的数据库用户作为数据库的管理员,密码是随机的,所以这里 //设定为'postgres' 2.修改PostgreSQL登录密码: postgres=# ALTER USER postgres WITH PASSWORD 'postgres'; //postgres=#为PostgreSQL下的命令提示符 3.退出PostgreSQL psql客户端 postgres=# \q [代码说明] postgres的数据库用户作为数据库的管理员,密码是随机的,我人需要修改为指定的密码,这里设定为’postgres’ 第二步:修改linux系统的postgres用户的密码(密码与数据库用户postgres

    1.8K10编辑于 2022-03-28
  • 来自专栏程序人生

    renovate: 处理 Postgres 模式迁移

    然而 atlas 对 Postgres 的支持并不太好,生成的 migration plan 很多时候都是破坏性的(比如 drop table 再 crate table),这根本无法在生产环境使用。 这是我当时写下的整个用户流程: # dump all the schemas into a folder $ renovate schema init --url postgres://user@localhost y Successfully applied migration to postgres://user@localhost:5432/hello. 有了这个思路,接下来就是一些大的数据结构的定义,比如 postgres 下的一个 schema 可以这样描述: pub struct Schema { pub types: BTreeMap<String

    1.1K20编辑于 2023-02-23
  • 来自专栏黑客下午茶

    Zalando Postgres Operator 快速上手

    UI 创建 Postgres cluster 通过 psql 连接到 Postgres cluster 删除 Postgres cluster 本指南旨在让您快速了解在本地 Kubernetes 环境中使用 Postgres Operator。 配置选项 只能在部署新的 Postgres 集群之前配置 Postgres Operator。 对于 postgres-operator 和 postgres-pod 集群角色,这还需要一组稍微不同的规则。 现在,是时候提交您的第一个 Postgres 集群清单了。

    2.9K20编辑于 2022-05-17
  • 来自专栏沃趣科技

    优化Postgres-x2 GTM

    Postgres-x2是一个基于pgsql、面向OTLP的分布式数据库,采用了shared-nothing的架构,目标是针对OLTP\OLAP应用能做到可扩展的系统。 源码在github上:https://github.com/postgres-x2/postgres-x2 最近在针对 Postgres-x2做压力测试。

    1.6K60发布于 2018-03-23
  • 来自专栏超级架构师

    Designing your SaaS Database for Scale with Postgres

    After our blog post on sharding a multi-tenant app with Postgres, we received a number of questions on

    94240发布于 2018-04-09
  • 领券