使用临时表进行 zend 搜索,然后与数据集合并
在我当前的设置中,我有一个 zend lucene 搜索索引,它将 my_table 行的主键以及其他未存储的字段存储在索引中。
搜索时会查询索引,然后将结果循环并插入到 mysql 临时表中,然后通过主键将其连接到 my_table 上。
然后,这允许我执行高级 sql 查询(例如,使用半正矢公式、从其他连接表获取数据、按分数过滤然后按日期过滤等等)。
我只是想知道这是否是一个好的实施。它有效,但我担心插入的数量,因为这个数据集可能很大(几千条记录)。
提前致谢
In my current setup i have a zend lucene search index which stores the primary keys of my_table rows in the index, along with other unstored fields.
Upon a search the index is queried, the results of which then are looped through and inserted into a mysql temporary table, which is then joined via the primary key onto my_table.
This then allows me to perform advanced sql queries (eg. using the haversine formula, getting data from other joined tables, filtering by score then date and so on).
I just wanted to know whether this was a good implementation. It works, but i'm concerned about the number of inserts as this dataset is likely to be pretty big (few thousand records).
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是否有必要将它们实际插入到数据库中?为什么不直接获取列表并执行类似
...WHERE id IN (id1, id2, id3, ...)
的操作。Is it necessary to actually insert them into the database? Why don't you just take the list and do something like
...WHERE id IN (id1, id2, id3, ...)
.