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

introduce_pattern_matching_with_mongo-clarify

 introduce_pattern_matching_with_mongo-clarify

Hello hey for Engineers vol.3で発表した内容です。

1fabfca5092bfe3f0712a0e66392f165?s=128

morihirok

May 09, 2019
Tweet

Transcript

  1. Introduce Pattern matching with mongo-clarify Hello hey for Engineers vol.3

    @_morihirok
  2. About me • Github: morihirok • Twitter: @_morihirok • STORES.jp


    ϓϩμΫτਪਐνʔϜ
  3. Ruby 2.7ͷ৽ػೳ Pattern matching͕ ໘നͦ͏

  4. 3VCZ,BJHJ1BUUFSONBUDIJOH/FXGFBUVSFJO3VCZΑΓҾ༻ IUUQTTQFBLFSEFDLDPNL@UTKQBUUFSONBUDIJOHOFXGFBUVSFJOSVCZEPU

  5. 3VCZ,BJHJ1BUUFSONBUDIJOH/FXGFBUVSFJO3VCZΑΓҾ༻ IUUQTTQFBLFSEFDLDPNL@UTKQBUUFSONBUDIJOHOFXGFBUVSFJOSVCZEPU

  6. ࢖ͬͯΈ͍ͨͷͰ Կ͔࡞Ζ͏

  7. .POHP%#YΠϯσοΫεੜ੒લޙͷFYQMBJO ݁ՌΛಡΉΑΓҾ༻ IUUQTCMPHNLOLJTLDPNNPOHPECJOEFYFYQMBJO

  8. MongoDBͷexplain͸ গ͠ಡΈͮΒ͍…

  9. MongoDBͷexplain݁Ռͷ αϯϓϧ > db.items.find({price: 119}).explain("executionStats") { "queryPlanner" : { "plannerVersion"

    : 1, "namespace" : "sample_db.items", "indexFilterSet" : false, "parsedQuery" : { "price" : { "$eq" : 119 } }, "winningPlan" : { "stage" : "COLLSCAN", "filter" : { "price" : { "$eq" : 119 } શͯ+40/Ͱදݱ͞ΕΔ
  10. ͜ΕΛಡΈ΍͘͢ දࣔͤ͞Δͷʹ Pattern matching͕ ศརͦ͏

  11. ͱ͍͏͜ͱͰ࡞ͬͨͷ͕͜Ε FYQMBJOͷ+40/Λ ͍͍۩߹ʹ.BSLEPXOͷ ςʔϒϧʹม׵͢Δ

  12. ΠϯσοΫε͕ޮ͍ͯͳ͍ͱ͖ͷ explain݁Ռ ͕͜͜z$0--4$"/zʹͳΔ

  13. ͜͏ॻ͚Δ ͕͜͜z$0--4$"/zʹͳΔ

  14. ΠϯσοΫε͕ޮ͍͍ͯΔͱ͖ͷ explain݁Ռ ͕͜͜z'&5$)zʹมΘΔ ͕͜͜z*94$"/zʹͳΔ ͜͜ʹΠϯσοΫε໊͕ೖΔ

  15. ͜͏ॻ͚Δ ͕͜͜z'&5$)zʹมΘΔ ͕͜͜z*94$"/zʹͳΔ ͜͜ʹΠϯσοΫε໊͕ೖΔ

  16. ͜͏ॻ͚Δ ม਺ΛόΠϯυͰ͖Δ ͜͜ʹΠϯσοΫε໊͕ೖΔ

  17. ࠷ऴతʹ͸͜͏ͳΔ

  18. STORES.jpͰ΋ ͍͍ײ͡ʹ࢖͑ͦ͏

  19. ໰୊ൃੜ

  20. Ruby 2.7(trunk)͡Όͳ͍ͱ ࢖͑ͳ͍

  21. Pattern matchingແ͠Ͱ ॻ͖׵͑Δ

  22. Pattern matchingແ͠Ͱ ॻ͖׵͑Δ

  23. কདྷతʹ ॏๅ͞Εͦ͏ͳ༧ײ

  24. ࠓ೔ͷίʔυ͸ͪ͜Β͔Β IUUQTHJUIVCDPNNPSJIJSPLNPOHPDMBSJGZ