向远程表中的列添加索引 - Oracle
我正在使用 DBLink 查询远程数据库。现在我想加快查询速度,如何向远程表中的几列添加索引。 如果有人可以提供任何类似的建议,我将不胜感激。
Am querying a remote database using DBLink. Now am wondering to speed up the query, how can i add indexes to few columns in the remote table.
Would appreciate if anyone can provide any recommendations around the same.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您可以在远程数据库上使用 DBMS_JOB 或 DBMS_SCHEDULER 包来调度作业,执行 DDL。
但是考虑一下,如果 Oracle 通过数据库链接抛出 DDL 异常,那么一定有充分的理由,对吗?您不希望任何人通过数据库链接远程弄乱您的架构。因此,与远程 DBA 交谈并尝试与他/她一起找出解决方案。
You could use DBMS_JOB or DBMS_SCHEDULER packages on the remote database to schedule a job, executing DDL.
But consider this, if Oracle throws an exception for DDL over databse links, there must be a good reason for it, right? You don't want anyone messing with your schema remotely over a database link. So instead, talk to the remote DBA and try to figure out solutions with him/her.
它不能通过 dblink 完成(即使您的 dblink 使用所属架构),您将看到
it can't be done over the dblink (even if your dblink is using the owning schema) you will see
您可以根据您的查询在远程数据库中创建一个物化视图,向其中添加您首选的索引,然后,如果需要,为该物化视图创建一个同义词。
You could create a Materialized View in the remote database based in your query, add your prefered indexes to it, and then, if you need it, create a synonym for that materialized view.
约翰,
以下关于“调优分布式查询”的 Oracle 文档是一个不错的起点。
http://download.oracle.com/docs/cd /B28359_01/server.111/b28310/ds_appdev004.htm
John,
A good place to start would be the following Oracle documentation on "Tuning Distributed Queries".
http://download.oracle.com/docs/cd/B28359_01/server.111/b28310/ds_appdev004.htm
您可以在远程数据库中创建索引并在视图表单中构建查询(当然是在远程数据库中)。
这样,远程数据库将使用他获得的所有方法(如索引)完成查询,并只返回所需的结果。
you could create the indexes in the remote database and build up your query in a view form (in the remote database of course).
that way the remote database will complete the query using all the methods he got (like indexes) and bring you back only the wanted resultes.