Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Profiling queries for fun and profit

Profiling queries for fun and profit

Elasticsearch 2.2 received a query profiler. This meetup talk discussed how Lucene executes queries and then showed a demo of the new profiler.

Zachary Tong

March 24, 2016
Tweet

More Decks by Zachary Tong

Other Decks in Technology

Transcript

  1. 2 Elasticsearch 2.2 received a profiler! • Attempts to time

    execution of query components • Best-effort profiling • Expensive! Verbose! “SQL Explain for ES” https://www.elastic.co/guide/en/elasticsearch/reference/current/search-profile.html
  2. 11 Shard 1 Search Request Collector 2 S W Documents

    A request can use multiple collectors
  3. 12 Shard 1 Search Request Collector 2 S W Documents

    A request can use multiple collectors
  4. 13 Shard 1 Search Request Collector 2 S W Documents

    A request can use multiple collectors
  5. 14 A query often has multiple scorers Shard 1 Search

    Request Collector S W Documents S W
  6. 15 A query often has multiple scorers Shard 1 Search

    Request Collector S W Documents S W ✓
  7. 16 A query often has multiple scorers Shard 1 Search

    Request Collector S W Documents S W ✓
  8. 17 A query often has multiple scorers Shard 1 Search

    Request Collector S W Documents S W ✓
  9. 18 A query often has multiple scorers Shard 1 Search

    Request Collector S W Documents S W ✓ ✓
  10. 19 A query often has multiple scorers Shard 1 Search

    Request Collector S W Documents S W ✓ ✓
  11. 20 A query often has multiple scorers Shard 1 Search

    Request Collector S W Documents S W ✓ ✓ ✓ Match!
  12. 21 Shard 1 Search Request Collector 2 S W Documents

    A request can use multiple collectors
  13. 22 Shard 1 Search Request Collector 2 S W Documents

    A request can use multiple collectors
  14. 23 Shard 1 Search Request Collector 2 S W Documents

    A request can use multiple collectors
  15. 24 And a request can hit multiple shards Search Request

    Shard 1 Documents Shard 2 Documents
  16. ‹#› Please attribute Elastic with a link to elastic.co Except

    where otherwise noted, this work is licensed under http://creativecommons.org/licenses/by-nd/4.0/ Creative Commons and the double C in a circle are registered trademarks of Creative Commons in the United States and other countries. Third party marks and brands are the property of their respective holders. 28