Skip to content

Instantly share code, notes, and snippets.

@andrewchilds
Last active September 10, 2021 16:22
Show Gist options
  • Select an option

  • Save andrewchilds/11831dc82093e53d41af to your computer and use it in GitHub Desktop.

Select an option

Save andrewchilds/11831dc82093e53d41af to your computer and use it in GitHub Desktop.

Revisions

  1. andrewchilds revised this gist Jun 2, 2017. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions gistfile1.sql
    Original file line number Diff line number Diff line change
    @@ -15,3 +15,10 @@ FROM item_occurrence
    WHERE timestamp > unix_timestamp() - 60 * 60 * 24 * 7
    GROUP BY 1
    ORDER BY 2 DESC

    # List counts of arbitrary "statusCode" values from item #1234
    SELECT body.message.extra.statusCode, count(body.message.extra.statusCode)
    FROM item_occurrence
    WHERE item.counter = 1234
    GROUP BY 1
    LIMIT 1000
  2. andrewchilds revised this gist Dec 18, 2015. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions gistfile1.sql
    Original file line number Diff line number Diff line change
    @@ -8,3 +8,10 @@ ORDER BY 2 DESC
    SELECT client.javascript.code_version, min(timestamp), max(timestamp)
    FROM item_occurrence
    GROUP BY 1

    # List top 100 user agent strings over last week
    SELECT client.javascript.browser, count(*)
    FROM item_occurrence
    WHERE timestamp > unix_timestamp() - 60 * 60 * 24 * 7
    GROUP BY 1
    ORDER BY 2 DESC
  3. andrewchilds created this gist Jun 8, 2015.
    10 changes: 10 additions & 0 deletions gistfile1.sql
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    # List users by average and maximum session length.
    SELECT person, max(client.runtime_ms), avg(client.runtime_ms)
    FROM item_occurrence
    GROUP BY 1
    ORDER BY 2 DESC

    # List active date ranges for each deploy.
    SELECT client.javascript.code_version, min(timestamp), max(timestamp)
    FROM item_occurrence
    GROUP BY 1