Questions tagged «postgresql-fdw»

1
postgres_fdw性能慢
以下针对外部对象的查询大约需要5秒钟才能在320万行上执行: SELECT x."IncidentTypeCode", COUNT(x."IncidentTypeCode") FROM "IntterraNearRealTimeUnitReflexes300sForeign" x WHERE x."IncidentDateTime" >= '05/01/2016' GROUP BY x."IncidentTypeCode" ORDER BY 1; 当我在普通表上执行相同的查询时,它将在0.6秒内返回。执行计划完全不同: 普通表 Sort (cost=226861.20..226861.21 rows=4 width=4) (actual time=646.447..646.448 rows=7 loops=1) Sort Key: "IncidentTypeCode" Sort Method: quicksort Memory: 25kB -> HashAggregate (cost=226861.12..226861.16 rows=4 width=4) (actual time=646.433..646.434 rows=7 loops=1) Group Key: "IncidentTypeCode" -> Bitmap Heap …

1
外部服务器的权限被拒绝
我试图建立一个具有有限权限的用户,该用户将能够创建外部表。我有两个数据库,hr_db和accounting_db。我已经hr_user为hr_db和创建了一个accounting_user用户accounting_db。我只希望accounting_user用户对某些hr_db表(例如表)具有选择权限users。为此,以超级用户身份进入hr_db数据库并运行: GRANT CONNECT ON DATABASE hr_db TO accounting_user; GRANT SELECT ON people TO accounting_user; 我设置了一个连接hr_db从accounting_db使用外国数据包装: CREATE SERVER hr_db FOREIGN DATA WRAPPER postgres_fdw OPTIONS (host 'localhost', dbname 'hr_db', port '5432'); 然后,我为accounting_user用户添加了一个映射: CREATE USER MAPPING FOR accounting_user SERVER hr_db OPTIONS (user 'accounting_user', password 'secretpassword'); 的密码accounting_user与我从命令行登录时使用的密码相同。这很好用: psql -U accounting_user -W hr_db [enter accounting_user …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.