Skip to content
Snippets Groups Projects
Commit 3b6acb34 authored by jurgenhaas's avatar jurgenhaas
Browse files

Script to create SQL script to create missing indixes on a list of databases at once

parent d72bbd89
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python
import argparse
parser = argparse.ArgumentParser(description='Create SQL Script to create missing indixes')
parser.add_argument('table', help='Name of the table')
parser.add_argument('column', help='Name of the column (and the index)')
args = parser.parse_args()
with open('dbs.list', 'r') as content:
databases = content.readlines()
databases = [database.strip() for database in databases]
with open('index.sql', 'w') as script:
for database in databases:
script.write('create index %s on %s.%s (%s);\n' % (args.column, database, args.table, args.column))
......@@ -87,5 +87,6 @@
with_items:
- 'mysqltuner.pl'
- 'tuning-primer.sh'
- 'mysql-create-index.py'
when: '"mysql" not in excluded_roles'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment