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 variable_value into @start | |
from information_schema.global_status | |
where variable_name = 'innodb_lsn_current'; | |
SELECT sleep(60); | |
SELECT variable_value into @end | |
from information_schema.global_status | |
where variable_name = 'innodb_lsn_current'; |
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
var rbtn = document.getElementsByName("objname"); | |
var nbtns = rbtn.length; | |
for (i=0; i<nbtns; i++) { | |
if (rbtn[i].checked) { | |
window.alert(rbtn[i].value); | |
} | |
} |
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
DROP TABLE IF EXISTS stats_history; | |
-- Create table | |
CREATE TABLE `stats_history` (`id` bigint(20) NOT NULL AUTO_INCREMENT, | |
`runTime` datetime DEFAULT NULL, | |
`TABLE_SCHEMA` varchar(192) NOT NULL DEFAULT '', | |
`TABLE_NAME` varchar(192) NOT NULL DEFAULT '', | |
`ROWS_READ` bigint(21) unsigned NOT NULL DEFAULT '0', | |
`ROWS_CHANGED` bigint(21) unsigned NOT NULL DEFAULT '0', | |
`ROWS_CHANGED_X_INDEXES` bigint(21) unsigned NOT NULL DEFAULT '0', |
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 user | |
, group_concat(time) | |
, count(*) | |
FROM information_schema.processlist | |
WHERE user NOT IN ('some_user') -- Filter out users | |
AND time > ## -- Filter by time | |
AND command NOT IN ('sleep') -- Filter by command | |
GROUP BY 1 | |
ORDER BY 3; |
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
STOP SLAVE; | |
SET GTID_NEXT=""; | |
BEGIN; COMMIT; | |
SET GTID_NEXT="AUTOMATIC"; | |
START SLAVE; | |
SHOW SLAVE STATUS\G |
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 t.trx_id | |
, t.trx_mysql_thread_id | |
, p.User | |
, SUBSTRING(p.Host, 1, LOCATE(':', p.Host) -1) AS Host | |
, SUBSTRING(p.Host, LOCATE(':', p.Host) + 1) AS Port | |
, t.trx_state | |
, t.trx_started | |
, ROUND(p.Time/60, 2) Mins | |
, p.command | |
, p.State |
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 user | |
, total_connections | |
, concurrent_connections | |
, select_commands | |
, rows_fetched | |
, table_rows_read | |
, IF (table_rows_read >= rows_fetched | |
,ROUND((rows_fetched/table_rows_read), 5) * 100 | |
, 100) as efficiency | |
FROM information_schema.user_statistics |
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
-- Get the unique PARTITION_EXPRESSION values | |
SELECT DISTINCT PARTITION_EXPRESSION | |
FROM information_schema.partitions; | |
-- Mappings | |
-- TO_DAYS() => FROM_DAYS() | |
-- UNIX_TIMESTAMP() => FROM_UNIXTIME() | |
SELECT TABLE_SCHEMA | |
, TABLE_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 '00000001' || LPAD(SUBSTRING(trim(' ' || pg_last_xlog_replay_location() || ' ') FROM 1 FOR position('/' in trim(' ' || pg_last_xlog_replay_location() || ' '))-1), 8, '0') || LPAD(SUBSTRING(trim(' ' || pg_last_xlog_replay_location() || ' ') FROM position('/' in trim(' ' || pg_last_xlog_replay_location() || ' '))+1 FOR 2), 8, '0') as last_wal | |
, SUBSTRING(trim(' ' || pg_last_xlog_replay_location() || ' ') FROM position('/' in trim(' ' || pg_last_xlog_replay_location() || ' '))+3 ) as last_lsn | |
, '00000001' || LPAD(SUBSTRING(trim(' ' || pg_last_xlog_receive_location() || ' ') FROM 1 FOR position('/' in trim(' ' || pg_last_xlog_receive_location() || ' '))-1), 8, '0') || LPAD(SUBSTRING(trim(' ' || pg_last_xlog_receive_location() || ' ') FROM position('/' in trim(' ' || pg_last_xlog_receive_location() || ' '))+1 FOR 2), 8, '0') as last_wal_rev | |
, SUBSTRING(trim(' ' || pg_last_xlog_receive_location() || ' ') FROM position('/' in trim(' ' || pg_last_xlog_receive_location() || ' '))+3 ) as last_lsn_recv | |
, CASE WHE |
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 | |
# This file contains the user/password combination to connect to the database | |
source creds.sh | |
DATE=`date +%Y%m%d` | |
instancedirectory="/var/lib/" | |
retval=-1 | |
backupdirectory="${1}" | |
exportconfig="${2}" | |
socket="${instancedirectory}/mysql.sock" | |
config="${instancedirectory}/mysql.cnf" |
OlderNewer