Skip to content

Instantly share code, notes, and snippets.

@githoov
Created January 7, 2016 21:18
Show Gist options
  • Save githoov/fa742851813f50154426 to your computer and use it in GitHub Desktop.
Save githoov/fa742851813f50154426 to your computer and use it in GitHub Desktop.
Redshift Table Skew
- explore: table_skew
hidden: true
- view: table_skew
derived_table:
sql: |
SELECT *
FROM svv_table_info
fields:
- dimension: database
sql: ${TABLE}.database
- dimension: schema
sql: ${TABLE}.schema
- dimension: table_id
type: number
sql: ${TABLE}.table_id
- dimension: table
sql: ${TABLE}."table"
- dimension: encoded
sql: ${TABLE}.encoded
- dimension: diststyle
sql: ${TABLE}.diststyle
- dimension: sortkey1
sql: ${TABLE}.sortkey1
- dimension: max_varchar
type: number
sql: ${TABLE}.max_varchar
- dimension: sortkey1_enc
sql: ${TABLE}.sortkey1_enc
- dimension: sortkey_num
type: number
sql: ${TABLE}.sortkey_num
- dimension: size
type: number
sql: ${TABLE}.size
- dimension: pct_used
type: number
sql: ${TABLE}.pct_used
- dimension: empty
type: number
sql: ${TABLE}.empty
- dimension: unsorted
sql: ${TABLE}.unsorted
- dimension: stats_off
type: number
sql: ${TABLE}.stats_off
- dimension: tbl_rows
type: number
sql: ${TABLE}.tbl_rows
- dimension: skew_sortkey1
type: number
sql: ${TABLE}.skew_sortkey1
- dimension: skew_rows
type: number
sql: ${TABLE}.skew_rows
html: |
{% if value < 25 %}
<div style="color:#B40404; background-color:#22CE7E; font-size:100%; text-align:center">{{ rendered_value }}</div>
{% elsif value >= 25 and value < 50 %}
<div style="color:#868A08; background-color:#95F047; font-size:100%; text-align:center">{{ rendered_value }}</div>
{% elsif value >= 50 %}
<div style="color:#868A08; background-color:#C64646; font-size:100%; text-align:center">{{ rendered_value }}</div>
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment