나는 모자이크 컬렉션 (crawl02
)을 생성하고이 제한에 대한 색인을 생성합니다. _id 인덱스가없는 capped 콜렉션에서 MongoDB _id 쿼리를 수행하면 성능이 저하됩니다.
> db.system.indexes.find()
{ "v" : 1, "key" : { "_id" : 1 }, "ns" : "test.crawl02", "name" : "_id_" }
내가 응용 프로그램 및 쿼리 덮인 수집의
MongoDB Log
항상 출력 추적 로그들이받은 :
[conn2] warning: _id query on capped collection without an _id index, performance will be poor collection: test.crawl02
을.
var cursor = this.QueueCollection //crawl02
.Find(Query.GT("_id", this._lastId))
.SetFlags(QueryFlags.AwaitData |QueryFlags.TailableCursor
| QueryFlags.NoCursorTimeout)
.SetSortOrder(SortBy.Ascending("$natural"));
return (MongoCursorEnumerator<QueueMessage<T>>)cursor.GetEnumerator();
커서 변수에 대한에서 메시지를 읽어 덮인 수집을 조회하려면 코드 문 (C#을)
다음 MongoDB를 나에게 crawl02
을하지 해지는 이유
while(true){
if (this._cursor.MoveNext())
return this._currsor.Current;
else
return null
}
내가 이해가 안 돼요 색인이있다. 갱신에 의해
====================================
좋아, MongoDB office website에서 Tailable 커서에 대한 기사를 발견, 메시지는 다음과 같습니다
MongoDB를 로그 경고 때문이다Tailable cursors are only allowed on capped collections and can only return objects in natural order. Tailable queries never use indexes.
? Tailable queries never use indexes.??
================= 업데이트 2 죄송합니다. mongodb 로그 경고가 test.crawl02에 관한 것을 잊어 버렸습니다. 변경되었습니다.
죄송합니다. 내 post.it의 test.crawl02에 대한 변경, 나는 변경을 잊어 버렸습니다. – zhengchun