목차
Code

MongoDB's New Matcher

Jun 07, 2016 pm 04:30 PM
mongodb new

Discuss on Hacker News MongoDB 2.5.0 (an unstable dev build) has a? new implementation of the “Matcher” . The old Matcher is the bit of code in Mongo that takes a query and decides if a document matches a query expression. It also has to

Discuss on Hacker News

MongoDB 2.5.0 (an unstable dev build) has a?new implementation of the “Matcher”. The old Matcher is the bit of code in Mongo that takes a query and decides if a document matches a query expression. It also has to understand indexes so that it can do things like create a subsets of queries suitable for index covering. However, the structure of the Matcher code hasn’t changed significantly in more than four years and until this release, it lacked the ability to be easily extended. It was also structured in such a way that its knowledge could not be reused for query optimization. It was clearly ready for a rewrite.

The “New Matcher” in 2.5.0 is a total rewrite. It contains three separate pieces: an abstract syntax tree (hereafter ‘AST’) for expression match expressions, a parser from BSON into said AST, and a Matcher API layer that simulates the old Matcher interface while using all new internals. This new version is much easier to extend, easier to reason about, and will allow us to use the same structure for matching as for query analysis and rewriting.

This matcher rewrite is part of a larger project to restructure query execution, to optimize them, and to lay the groundwork for more advanced queries in the future. One planned optimization is index intersection. For example, if you have an index on each of ‘a’ and ‘b’ attributes, we want a query of the form?{ a : 5 , b : 6 }?to do an index intersection of the two indexes rather than just use one index and discard the documents from that index that don’t match. Index intersection would also be suitable for merging geo-spatial, text and regular indexes together in fun and interesting ways (i.e. a query to return all the users in a 3.5 mile radius of a location with a greater than #x# reputation who are RSVP’ed ‘yes’ for an event).

A good example of an extension we’d like to enable is self referential queries, such as finding all documents where a = b + c. (This would be written?{ a : { $sum : [ “$b” , “$c” ] } }). With the new Matcher, such queries are easy to implement as a native part of the language.

Now that the Matcher re-write is ready for testing, we’d love people to help test it by trying out MongoDB 2.5.0. (Release Notes)

Code

  • AST Root
  • Parser Root

By Eliot Horowitz, 10gen CTO, MongoDB core contributor. You can find the original post on his personal blog.?

본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.

뜨거운 기사 태그

메모장++7.3.1

메모장++7.3.1

사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전

SublimeText3 중국어 버전

중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기

스튜디오 13.0.1 보내기

강력한 PHP 통합 개발 환경

드림위버 CS6

드림위버 CS6

시각적 웹 개발 도구

SublimeText3 Mac 버전

SublimeText3 Mac 버전

신 수준의 코드 편집 소프트웨어(SublimeText3)

mongodb에는 일반적으로 어떤 버전이 사용됩니까? mongodb에는 일반적으로 어떤 버전이 사용됩니까? Apr 07, 2024 pm 05:48 PM

mongodb에는 일반적으로 어떤 버전이 사용됩니까?

nodejs와 vuejs의 차이점 nodejs와 vuejs의 차이점 Apr 21, 2024 am 04:17 AM

nodejs와 vuejs의 차이점

MongoDB를 활용한 실시간 추천 시스템 구현 경험 공유 MongoDB를 활용한 실시간 추천 시스템 구현 경험 공유 Nov 03, 2023 pm 04:37 PM

MongoDB를 활용한 실시간 추천 시스템 구현 경험 공유

mongodb 데이터베이스의 장점은 무엇입니까? mongodb 데이터베이스의 장점은 무엇입니까? Apr 07, 2024 pm 05:21 PM

mongodb 데이터베이스의 장점은 무엇입니까?

mongodb가 생성한 데이터베이스는 어디에 있나요? mongodb가 생성한 데이터베이스는 어디에 있나요? Apr 07, 2024 pm 05:39 PM

mongodb가 생성한 데이터베이스는 어디에 있나요?

몽고디비는 무슨 뜻인가요? 몽고디비는 무슨 뜻인가요? Apr 07, 2024 pm 05:57 PM

몽고디비는 무슨 뜻인가요?

mongodb 데이터베이스 파일은 어디에 있나요? mongodb 데이터베이스 파일은 어디에 있나요? Apr 07, 2024 pm 05:42 PM

mongodb 데이터베이스 파일은 어디에 있나요?

몽고디비를 여는 방법 몽고디비를 여는 방법 Apr 07, 2024 pm 06:15 PM

몽고디비를 여는 방법

See all articles