Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-28954

Analytics beer tutorial needs some corrections and updates

    XMLWordPrintable

Details

    • Untriaged
    • Unknown
    • CX Sprint 98, CX Sprint 99, CX Sprint 100

    Description

      j1. In Query 3's text: "... all of the matching user/message data ..." should instead say "... all of the matching beer/brewery data ..." (!!).

      2. In Query 7 there is a stray semi-colon on the second-to-last line of the query that results in a syntax error.

      3. Query 9 uses syntactic shorthand that is no longer supported - so it actually results in a semantic error message rather than running now.:

      [{
          "code": 1,
          "msg": "Cannot resolve ambiguous alias reference for undefined identifier num_beers in [#1, $brewery_id]",
          "query_from_user": "SELECT br.brewery_id, COUNT(*) AS num_beers\nFROM beers br\nGROUP BY br.brewery_id\nHAVING num_beers > 30\nORDER BY num_beers DESC;"
      }]
      

      A possible corrected version to offer would be:

      SELECT br.brewery_id, COUNT(*) AS num_beers
      FROM beers br
      GROUP BY br.brewery_id
      HAVING COUNT(*) > 30
      ORDER BY num_beers DESC;
      

      (Or we could use a LET statement to define num_beers instead.)

      4. It might be nice to update the little indexing section to instruct the user to EXPLAIN the plan, look at the plan, add the index, and re-EXPLAIN to see the difference?

      BTW, while I was going through all of this, the part that illustrates shadowing by doing a N1QL update got me into a weird state for a little while - for some reason, my system was in a state where the change didn't propagate.  Later it self-resolved (while I took a break to give a talk in a meeting) - so it "works again" - but it was mysterious and disconcerting for a little while there...

       

       

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              till Till Westmann
              mike.carey Mike Carey
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty