- The top 5 proactive measures to minimize MySQL downtime
- The small improvements of MySQL 5.6: Duplicate Index Detection
- Keynotes, BOFs, and the Community Networking Reception at Percona Live MySQL Conference and Expo
- Analyzing Slow Query Table in MySQL 5.6
- Percona Toolkit by example – pt-stalk
- innodb_stats_on_metadata and slow queries on INFORMATION_SCHEMA
- [Webinar: SQL Query
This file contains hidden or 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
pt-variable-advisor localhost --user=root --ask-pass | |
Just compare in mysqld section | |
pt-config-diff /etc/my.cnf.d/server.cnf h=localhost --user=root --ask-pass | |
pt-config-diff /etc/my.cnf.d/server.cnf /etc/my.cnf.d/server1.cnf | |
pt-summary | |
pt-mysql-summary --user=root --ask-pass |
This file contains hidden or 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
import json | |
import pg8000 as dbapi | |
from pprint import pprint | |
def getconnection(database,host,port,user,password): | |
conn= None | |
try: | |
conn=dbapi.connect(database=database,host=host, port=port,\ | |
user=user,password=password,ssl=True) | |
except Exception as err: |
This file contains hidden or 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
package testjava; | |
import java.util.HashMap; | |
import java.util.Random; | |
/* | |
* URL Shortener | |
*/ | |
public class URLShortener { | |
// storage for generated keys |
This file contains hidden or 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
WITH COLUMN_DEFINITION AS ( | |
SELECT | |
TABLE_NAME, | |
COLUMN_NAME, | |
CASE | |
WHEN (DATA_TYPE= 'NUMBER' AND DATA_SCALE = 0 AND DATA_PRECISION <= 9) THEN 'INTEGER' | |
WHEN (DATA_TYPE= 'NUMBER' AND DATA_SCALE = 0 AND DATA_PRECISION <= 18) THEN 'BIGINT' | |
WHEN (DATA_TYPE= 'NUMBER' AND DATA_SCALE = 0 AND DATA_PRECISION >= 19) THEN 'DECIMAL(' || DATA_PRECISION || ',0)' | |
WHEN (DATA_TYPE= 'NUMBER' AND DATA_SCALE > 0) THEN 'DECIMAL(' || DATA_PRECISION || ',' || DATA_SCALE ||')' | |
WHEN (DATA_TYPE= 'NUMBER' AND nvl(DATA_SCALE,0) = 0 AND nvl(DATA_PRECISION,0) = 0) THEN 'DECIMAL(38,18)' |
This file contains hidden or 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 /* + RULE */ | |
df.tablespace_name AS "Tablespace" | |
,df.bytes / (1024 * 1024 * 1024) AS "Size (GB)" | |
,Trunc(fs.bytes / (1024 * 1024 * 1024)) AS "Free (GB)" | |
FROM ( | |
SELECT tablespace_name | |
,Sum(bytes) AS bytes | |
FROM dba_free_space | |
GROUP BY tablespace_name | |
) fs |
This file contains hidden or 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 OBJECT_TYPE | |
,OBJECT_SCHEMA | |
,OBJECT_NAME | |
FROM ( | |
SELECT 'TABLE' AS OBJECT_TYPE | |
,TABLE_NAME AS OBJECT_NAME | |
,TABLE_SCHEMA AS OBJECT_SCHEMA | |
FROM information_schema.TABLES | |
UNION |
This file contains hidden or 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 DISTINCT n.nspname AS schemaname | |
,c.relname AS tablename | |
,a.attname AS COLUMN | |
,a.attnum AS column_position | |
,pg_catalog.format_type(a.atttypid, a.atttypmod) AS TYPE | |
,pg_catalog.format_encoding(a.attencodingtype) AS encoding | |
,a.attisdistkey AS distkey | |
,a.attsortkeyord AS sortkey | |
,a.attnotnull AS notnull | |
,a.attencodingtype AS compression |