當前位置:首頁 » 操作系統 » postgresql查看資料庫

postgresql查看資料庫

發布時間: 2023-03-24 01:31:08

A. 如何查看postgresql資料庫埠號

可以去你資料庫的data數據位置(pgsql安裝完成後initdb的位置),裡面有一個postgresql.conf文件,搜索port,如果「port = xxxx」前沒有#(#為注釋內容,不生效的),說明你的資料庫配置的埠號就是這個,如果有#,採用默認的埠號:5432.
另外這個路徑下還有一個postmaste.pid(前提是你的資料庫已經啟動了),打開可以看到啟動的資料庫所佔埠號。
以上內容windows和linux版都一樣

B. postgresql怎麼查看資料庫參數設置

通嫌閉過參數文件查看,一般拍者虧是在$PGDATA/postgresql.conf文件里
或者在系統中查看,如襲神

postgres=# show shared_buffers;
shared_buffers
----------------
4GB
(1 row)

--查看所有參數
postgres=# show all;

C. 怎麼查看 PostgreSQL里的資料庫的表是否存在

往表裡更凱悶新數據前先查詢一遍被更新的數據存不存在。
通常做法是使用select 查詢過濾一遍,然後再決定是否更新,怎麼更盯兆彎新。
在PG庫里,除了以上方法外,還有一種更能提升性能的辦法,
使用perform來代替select。
Example:
Create or replace function test.insert_exist_test(i_id int,i_info text)
returns void
as
$BODY$
--author: kenyon
--created:2012_03_05
--purpose:test insert into a table if exists
declare
begin perform 1 from test.exists_test where id = i_id;
if not found then
insert into test.exists_test(id,info) values (i_id,i_info);
return;
else
update test.exists_test set info=i_info where id=i_id;
return;
end if;
exception when others then
raise exception 'Insert exists_test(id,info) values(%,%) error.',i_id,i_info;
return;
end;
$BODY$
language plpgsql;
使用:

select test.insert_exist_test(1,'kevin');
select test.insert_exist_test(2,'BruceLee');
select test.insert_exist_test(3,'Jacky');
select test.insert_exist_test(1,'猜野kenyon');

D. postgresql 查看有哪些表

1. 查詢表名稱

在psql狀態下查詢表名稱:dt

SQL方式查看錶名稱:

SELECTtablenameFROMpg_tables;

SELECT viewname FROM pg_views
WHERE schemaname ='public'

PostgreSQL獲取資料庫中所有view名視圖

SELECT viewname FROM pg_views

WHERE schemaname ='public'

2. 查詢表結構

在psql狀態下查詢表結構 dtablename

SQL方式查看錶結構

SELECT a.attnum,

a.attname AS field,

t.typname AS type,

a.attlen AS length,

a.atttypmod AS lengthvar,

a.attnotnull AS notnull,

b.description AS comment

FROM pg_class c,

pg_attribute a

LEFT OUTER JOIN pg_description b ON a.attrelid=b.objoid AND a.attnum = b.objsubid,
pg_type t

WHERE c.relname = 'udoc_saldiscount'

and a.attnum > 0

and a.attrelid = c.oid

and a.atttypid = t.oid

ORDER BY a.attnum;

(4)postgresql查看資料庫擴展閱讀:

PostgreSQL存儲系統是由以下幾個子模塊所構成的:

1)頁面管理子模塊:對PostgreSQL緩沖區頁面的組織結構進行定義以及提供頁面操作的方法。

2)緩沖區管理子模塊:管理PostgreSQL的緩沖區,包括本地緩沖區和共享緩沖區。

3)存儲設備管理子模塊:資料庫記錄是存儲在存儲介質上的,存儲設備管理子模塊將屏蔽不同物理存儲設備(塊設備,流設備)介面函數的差異,向上層緩沖區管理子模塊提供統一的訪問介面函數。

4)文件管理子模塊:一般的操作系統對一個進程允許打開的文件數是有限制的,而PostgreSQL伺服器有些時候需要打開的文件數是很多的,因此PostgreSQL文件管理子模塊自身為了突破這個瓶頸,封裝了文件的讀寫操作。

E. 如何查看postgresql資料庫用戶

1、通過命令行查詢
\d
資料庫
——
得到所有表的名字
\d
表名
——
得到表結構
2、通過sql語句查詢
"select
*
from
pg_tables"
——
得到當前db中所有表的信息(這里pg_tables是系統視圖)
"select
tablename
from
pg_tables
where
schemaname='public'"
——
得到所有用戶自定義表的名字(這里"tablename"欄位是表的名字,"schemaname"是schema的名孫瞎迅字則此神虧。用戶自定義的表,如果未經特殊處理,默認都是放在名為public的schema下)

F. 在postgresql中如何從資料庫中檢索出所有的表名

1、查看當前資料庫中所有的模式。

G. 如何查看伺服器postgresql 中資料庫

安裝PostgreSQL資料庫之後,默認是只接受本地訪問連接。如果想在其他主機上訪問PostgreSQL資料庫伺服器,就需要進行相 應的配置。配置遠程連接PostgreSQL資料庫的步驟很簡單,只需要修改data目錄下的pg_hba.conf和postgresql.conf, 其中pg_hba.conf是用來配置對資料庫的訪問許可權,postgresql.conf文件用來配置PostgreSQL資料庫伺服器的相應的參數。 下面介紹配置的步驟:

1.修改pg_hba.conf文件,配置用戶的訪問許可權:
# TYPE DATABASE USER CIDR-ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
host all all 192.168.1.0/24 md5
# IPv6 local connections:
host all all ::1/128 trust

其中紅色標識的內容為新添加的內容,表示允許網段192.168.1.0上的所有主機使用所有合法的資料庫用戶名訪問資料庫,並提供加密的密碼驗 證。在我們的環境中,我們需要在主機192.168.1.5上使用postgres用戶訪問192.168.1.9上的PostgreSQL資料庫。

2.修改postgresql.conf文件,將資料庫伺服器的監聽模式修改為監聽所有主機發出的連接請求。
定位到#listen_addresses='localhost'。PostgreSQL安裝完成後,默認是只接受來在本機localhost的連接請 求,通過將改行內容修改為listen_addresses='*'來允許資料庫伺服器監聽來自任何主機的連接請求:
listen_addresses = '*' # what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to 'localhost', '*' = all
# (change requires restart)
修改之後,保存並退出,然後重起資料庫,就可以在在遠程機器上訪問PostgreSQL資料庫了。

另外,資料庫管理小貼士:

matrix資料庫使用的是PostgreSQL資料庫。你可以安裝一個類似phpmyadmin的管理

H. postgresql資料庫怎麼查詢所有的序列名

1、在查詢的時候一般使用*查詢代表查詢所有欄位信息,但表太大就不建議使用這種方式。

I. postgresql查看資料庫怎麼查看指定的模式 數據表

可以使用pgAdminIII, 連接到資料庫服務之後,展開資料庫,就可以看到"模式",再展開模式,就可以看到此模式下的數據數據表,函數等對象了。

熱點內容
用友軟體sql 發布:2024-04-20 20:10:01 瀏覽:932
python倒著循環 發布:2024-04-20 20:09:52 瀏覽:758
雲伺服器遠程電腦版 發布:2024-04-20 20:09:12 瀏覽:258
ps資料庫 發布:2024-04-20 19:52:43 瀏覽:521
dpi的演算法 發布:2024-04-20 19:41:16 瀏覽:933
成興ca鎖密碼初始密碼是什麼 發布:2024-04-20 19:24:43 瀏覽:667
如何更准確的看手機配置 發布:2024-04-20 19:15:12 瀏覽:332
匯優的演算法 發布:2024-04-20 19:10:51 瀏覽:414
和平精英暗夜危機模式密碼是什麼 發布:2024-04-20 19:10:03 瀏覽:686
韓國泡泡安卓怎麼充值 發布:2024-04-20 18:56:27 瀏覽:295