cockroachdb / dist-trace-viewer

http://trace.crdb.io/
1 stars 3 forks source link

query obscured by a bunch of `SHOW DATABASE`s #19

Open vilterp opened 5 years ago

vilterp commented 5 years ago

This trace (https://gist.github.com/vilterp/3aaa50b5e8f983dd16bdf9518b686a80) was generated with:

SET tracing = on;
SELECT json_agg(json_build_array(
  id,
  name,
  cockroach_version,
  machine_type,
  experimental_strftime(created_at, '%Y-%m-%dT%H:%M:%S.%fZ'),
  experimental_strftime(updated_at, '%Y-%m-%dT%H:%M:%S.%fZ'),
  (
    SELECT json_agg(json_build_array(
      id,
      cluster_id,
      locality,
      num_nodes,
      experimental_strftime(created_at, '%Y-%m-%dT%H:%M:%S.%fZ'),
      experimental_strftime(updated_at, '%Y-%m-%dT%H:%M:%S.%fZ')
    ))
    FROM cluster_regions
    WHERE cluster_regions.cluster_id = clusters.id
  ),
  (
    SELECT json_agg(json_build_array(
      id,
      cluster_id,
      name,
      locality,
      machine_type,
      internal_address,
      external_address,
      experimental_strftime(created_at, '%Y-%m-%dT%H:%M:%S.%fZ'),
      experimental_strftime(updated_at, '%Y-%m-%dT%H:%M:%S.%fZ')
    ))
    FROM nodes
    WHERE nodes.cluster_id = clusters.id
  )
))
FROM clusters;
SET tracing = off;
SELECT * FROM crdb_internal.session_trace;

…in the cockroach sql shell.

There are a bunch of SHOW DATABASE traces cluttering things up:

image (All the repetitive sql txn spans are SHOW DATABASE)

Wondering two things:

  1. How do we let people filter out extraneous traces?
  2. Why are all these SHOW DATABASEs in my session recording?
vilterp commented 5 years ago

@andreimatei do you know why the shell is emitting all these SHOW DATABASE queries? I remember you mentioning something about extraneous queries being emitted from the shell.

andreimatei commented 5 years ago

Yeah, see this to avoid it https://github.com/cockroachdb/cockroach/pull/31630/commits/b9caa8274aa5ac60ba9eb2dd256d21cac7350e6d