您将如何在外国 table 上创建唯一索引?
How would you create a unique index on a foreign table?
数据库 1 在数据库 2 上有外部 tables a 和 b。
我们如何在这些外国 tablea 和 b 上创建索引。这些外来的 tables 分别是 database2.c 和 database2.d tables 的包装器,它们确实有必要的索引。
如何在外部 tablea 和 b 上创建索引?这可能吗?
我收到无法在国外创建索引 table - 当我在 postgres 中尝试一个简单的创建索引命令时
您不能在外部 table 上创建索引,而是在外部 table 上编写触发器并在 postgres 中创建本地 table 这样每当插入、更新或删除时发生在你的外国 table 它将反映在你的本地 table 并索引它。
加入外国 table 会导致查询变慢。
由于索引不是外部 table 的选项,请考虑在外部 table 上创建物化视图。物化视图确实允许索引
CREATE FOREIGN TABLE members_fdw(...)
CREATE MATERIALIZED VIEW members AS
select * from members_fdw
WITH DATA
CREATE UNIQUE INDEX "member_id" ON members USING btree ("id");
数据库 1 在数据库 2 上有外部 tables a 和 b。
我们如何在这些外国 tablea 和 b 上创建索引。这些外来的 tables 分别是 database2.c 和 database2.d tables 的包装器,它们确实有必要的索引。
如何在外部 tablea 和 b 上创建索引?这可能吗?
我收到无法在国外创建索引 table - 当我在 postgres 中尝试一个简单的创建索引命令时
您不能在外部 table 上创建索引,而是在外部 table 上编写触发器并在 postgres 中创建本地 table 这样每当插入、更新或删除时发生在你的外国 table 它将反映在你的本地 table 并索引它。
加入外国 table 会导致查询变慢。 由于索引不是外部 table 的选项,请考虑在外部 table 上创建物化视图。物化视图确实允许索引
CREATE FOREIGN TABLE members_fdw(...)
CREATE MATERIALIZED VIEW members AS
select * from members_fdw
WITH DATA
CREATE UNIQUE INDEX "member_id" ON members USING btree ("id");