This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func hashify(appList []string, vectorLength int64) ([]int){ | |
hashedList := make([]int, vectorLength) | |
for _, app := range appList { | |
hashedValue := sha256.New() | |
hashedValue.Write([]byte(app)) | |
hexStr := fmt.Sprintf("%x", hashedValue.Sum(nil)) | |
hexInt := new(big.Int) | |
hexInt, ok := hexInt.SetString(hexStr, 16) | |
if !ok { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT *, | |
pg_size_pretty(total_bytes) AS total, | |
pg_size_pretty(index_bytes) AS index, | |
pg_size_pretty(toast_bytes) AS toast, | |
pg_size_pretty(table_bytes) AS table | |
FROM ( | |
SELECT *, | |
total_bytes - index_bytes - coalesce(toast_bytes, 0) AS table_bytes | |
FROM ( | |
SELECT c.oid, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
current_database(), schemaname, tablename, /*reltuples::bigint, relpages::bigint, otta,*/ | |
round(avg((CASE WHEN otta=0 THEN 0.0 ELSE sml.relpages::float/otta END)::numeric),1) AS tbloat, | |
round(avg(CASE WHEN relpages < otta THEN 0 ELSE bs*(sml.relpages-otta)::BIGINT END), 0) AS wastedbytes | |
FROM ( | |
SELECT | |
schemaname, tablename, cc.reltuples, cc.relpages, bs, | |
CEIL((cc.reltuples*((datahdr+ma- | |
(CASE WHEN datahdr%ma=0 THEN ma ELSE datahdr%ma END))+nullhdr2+4))/(bs-20::float)) AS otta, | |
COALESCE(c2.relname,'?') AS iname, COALESCE(c2.reltuples,0) AS ituples, COALESCE(c2.relpages,0) AS ipages, |