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
-- SET GLOBAL event_scheduler = ON; | |
-- create table db_growth_history(db_name varchar(64), tbl_name varchar(64), avg_row_length int, row_count bigint, time_stamp datetime); | |
DELIMITER $$ | |
CREATE | |
EVENT `document_db_growth_history` | |
ON SCHEDULE EVERY 1 DAY | |
DO BEGIN | |
-- Grab db name, table name, avg row length, row count, add timestamp = growth_history |
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
-- SET GLOBAL event_scheduler = ON; | |
-- create table growth_history(tbl_name varchar(64), row_count bigint, time_stamp datetime); | |
DELIMITER $$ | |
CREATE | |
EVENT `document_growth_history` | |
ON SCHEDULE EVERY 1 DAY | |
DO BEGIN |
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 COUNT(*) FROM information_schema.tables WHERE table_schema = '<database_name>'; |
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 CONCAT( | |
'SELECT "', | |
table_name, | |
'" AS table_name, COUNT(*) AS exact_row_count FROM ', | |
table_schema, | |
'.', | |
table_name, | |
' UNION ' | |
) | |
FROM INFORMATION_SCHEMA.TABLES |
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 SUM(TABLE_ROWS) | |
FROM INFORMATION_SCHEMA.TABLES | |
WHERE TABLE_SCHEMA = '<database_name>'; |
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 TABLE_NAME, TABLE_ROWS FROM `information_schema`.`tables` WHERE `table_schema` = '<database_name>'; |
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
function load_queues($path) { | |
$queuesTemp = array(); | |
$contents = file_get_contents($path); | |
$contents = explode("\n", $contents); | |
foreach($contents as $content) | |
{ | |
if(!in_array(trim($content), $queuesTemp)) { | |
$queuesTemp[] = trim($content); |
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
#!/bin/sh | |
# | |
# <daemonname> <summary> | |
# | |
# chkconfig: <default runlevel(s)> <start> <stop> | |
# description: <description, split multiple lines with \ | |
# a backslash> | |
### BEGIN INIT INFO | |
# Provides: |
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
#!/bin/bash | |
# Usage: sub mytop [-u (username)] [-p (password)] | |
# Summary: Watch MySQL Processes / Queries | |
# Help: Take a snapshot of what mysql queries are running in one second intervals | |
# Reference: http://akrabat.com/software/the-watch-linux-command-line-tool/ | |
set -e | |
# Default Username & Password | |
_MYTOP_PASSWORD="-pYOURPASSWORD" # or "" for no password |
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
resolve_sub_dirs() { | |
path="" | |
path_arg="$1" | |
search="$path_arg/sub-"* | |
for command in $search; do | |
if [ -d "$command" ]; then | |
if [ "$path" != "" ]; then | |
path="$command:$path" | |
else |