Skip to content

Instantly share code, notes, and snippets.

WITH tables_info AS (
SELECT
s.relname AS table_name
, c.reltuples AS num_rows
, pg_size_pretty(pg_relation_size(quote_ident(s.relname)::text)) AS table_size
, pg_relation_size(quote_ident(s.relname)::text) AS table_byte_size
, s.seq_scan
, s.seq_tup_read
, s.idx_scan
, s.n_tup_ins
TABLE_NAME SCHEMA_TYPE MILLION_ROWS SIZE_GB
BOOKINGS_1923255480 AVRO 6313.07 M 394.29 GB
BOOKINGS_716156654 JSON 6313.04 M 546.96 GB
BOOKING_ORIGINAL_DETAILS_1491370834 JSON 354.23 M 13.16 GB
BOOKING_ORIGINAL_DETAILS_364742264 AVRO 354.23 M 6.73 GB
BOOKING_ORIGINS_2097479155 JSON 376.68 M 12.52 GB
BOOKING_ORIGINS_473753833 AVRO 376.68 M 6.25 GB
BOOKING_PRICE_ADJUSTMENTS_1609157398 JSON 1.55 M 0.24 GB
BOOKING_PRICE_ADJUSTMENTS_980878708 AVRO 0.82 M 0.04 GB

Classic Histogram vs Distribution Steps

Distrbution Steps es un estimador de tuplas que satisfacen una condicion, ya sea

  • Por igualdad ( a = 2)
  • Por menor ( a < 5) o (a <= 5)
  • Por mayor ( a > 2) o (a >= 2)

Los estimadores son utilizados en las bases de datos para seleccionar un plan de ejecucion optimo para el motor a la hora de realizar una consulta.

@emancu
emancu / printFolderTreeInstaller.sh
Created May 11, 2011 05:20
A plugin for nautilus to print the tree of selected directory
#!/bin/bash
#Coded by eMancu
#This script is under GNU license
#For any suggestions please contact me by twitter @eMancu or github
echo "Installing tree if it's not installed.." > /tmp/printFolderTreeinstall.log
gksudo -k --message "Print folder tree will install 'tree' program. Please insert sudo password" apt-get install tree &>> /tmp/printFolderTreeinstall.log
echo "Creating folder for nautilis scripts" >> /tmp/printFolderTreeinstall.log
@emancu
emancu / blogolico_box.html
Created February 6, 2010 14:54
Blogolico Box
<pre class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; width: 600px; height: auto; background-color: rgb(253, 250, 223); color: rgb(21, 105, 199); text-align: left;">
</pre>
def permutations
return [self] if self.length < 2
ret = []
0.upto(self.length - 1) do |n|
rest = self.split('')
picked = rest.delete_at(n)
rest.join.permutations.each { |x| ret << picked + x }
end