匹配/反对和交易 [英] Match/Against and transactions
问题描述
在事务中使用match/against时,似乎无法从临时未提交的数据中查询:
When using match/against inside a transaction, it does not seem to query from the temporary uncommited data:
start transaction;
insert into feed_full_text (feed_id, full_text) values (5000008, "lorem ipsum");
select feed_id, full_text
from feed_full_text
where feed_id = 5000008 and match(full_text) against("lorem" in boolean mode)
order by feed_id desc
limit 1;
commit
未返回任何结果,
start transaction;
insert into feed_full_text (feed_id, full_text) values (5000008, "lorem ipsum");
select feed_id, full_text
from feed_full_text
where feed_id = 5000008
order by feed_id desc
limit 1;
commit
返回刚刚插入的行,并且:
Returns the just inserted row, and:
insert into feed_full_text (feed_id, full_text) values (5000008, "lorem ipsum");
select feed_id, full_text
from feed_full_text
where feed_id = 5000008 and match(full_text) against("lorem" in boolean mode)
order by feed_id desc
limit 1;
也返回该行.这是一个错误还是我错过了什么?我正在使用5.7.11,其中支持InnoDB中的全文本索引.
Returns the row as well. Is this a bug or am I missing something? I am using 5.7.11 where full-text indexes in InnoDB are supported.
推荐答案
这是预期的行为. 文档说:
This is the expected behavior. The documentation says:
InnoDB全文索引事务处理 InnoDB FULLTEXT索引由于具有缓存和批处理行为,因此具有特殊的事务处理特性.具体来说,在事务提交时处理FULLTEXT索引上的更新和插入,这意味着FULLTEXT搜索只能看到提交的数据.
InnoDB Full-Text Index Transaction Handling
InnoDB FULLTEXT indexes have special transaction handling characteristics due its caching and batch processing behavior. Specifically, updates and insertions on a FULLTEXT index are processed at transaction commit time, which means that a FULLTEXT search can only see committed data.
这篇关于匹配/反对和交易的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!