如何同步和优化 Oracle Text 索引?
我们希望使用 ctxsys.context 索引类型进行全文搜索。但令我感到非常惊讶的是,这种类型的索引不会自动更新。我们有 300 万个文档,每天约有 1 万次更新/插入/删除。
您对同步和优化 Oracle Text 索引有何建议?
We want to use a ctxsys.context
index type for full text search. But I was quite surprised, that an index of this type is not automatically updated. We have 3 million documents with about 10k updates/inserts/deletes per day.
What are your recommendations for syncing and optimizing an Oracle Text index?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
“不自动更新”是什么意思?
索引可以在提交时同步或定期同步。
如果您不需要实时搜索准确性,我们的 DBA 建议定期同步索引,例如每 2 分钟一次。如果你能负担得起过夜的费用,那就更好了。什么是最好的取决于您的负载和文档的大小。
这些链接可能可以为您提供更多信息:
对于 DBA 的建议,也许 serverfault 更好?
What do you mean by "not automatically updated"?
The index can be synchronized on commit or periodically.
I you don't need real-time search accuracy our DBA recommended to sync the index periodically, say each 2 min. If you can afford to do it overnight, then even better. What is best depends on your load and the size of the document.
These links can probably provide you with more information:
For DBA advice, maybe serverfault is better?
将此作为 Oracle 12C 用户的更新放在此处。
如果您在实时模式下使用索引,那么它会将项目保留在内存中,并定期推送到主表,从而减少碎片并启用对流内容的 NRT 搜索。
以下是如何设置它,
这将在 NRT 模式下设置索引。非常甜蜜。
Putting this here as an update for Oracle 12C users.
If you use the index in real time mode, then it keeps items in memory, and periodicially pushes to the main tables, which keeps fragmentation down and enables NRT search on streaming content.
Here's how to set it up
this will set up the index in NRT mode. It's pretty sweet.
我认为“SYNC EVERY”选项(如之前的答案中所述)仅在 Oracle 10g 或更高版本中可用。如果您使用旧版本的 Oracle,则必须定期运行同步操作。例如,您可以创建以下存储过程:
然后通过 DBMS_JOB 调度它运行:
对于索引优化,可以使用以下命令(也可以通过 DBMS_JOB 或通过 cron 调度):
还有具有类似功能的 CTX_* 包可用。
I think 'SYNC EVERY' option, as described in previous answer only available in Oracle 10g or newer. If you're using older version of Oracle you would have to run sync operation periodically. For example, you can create following stored procedure:
and then schedule it run via DBMS_JOB:
As for index optimization, following command can be used (also can be scheduled with DBMS_JOB or via cron):
There is also CTX_* package with similar function available.