forked from bobbydurrett/PythonDBAGraphs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgroupsigs.py
More file actions
63 lines (43 loc) · 2 KB
/
groupsigs.py
File metadata and controls
63 lines (43 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
"""
PythonDBAGraphs: Graphs to help with Oracle Database Tuning
Copyright (C) 2016 Robert Taft Durrett (Bobby Durrett)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Contact:
bobby@bobbydurrettdba.com
groupsigs.py
This shows the average elapsed time and total number of executions for
a group of SQL statements defined by their force matching signature.
A signature represents a group of queries that are the same except for their
constants. The goal of this query is to pick some group of queries
that we care about such as the main queries the users use every day and
show their performance over time. It does hide the details of the individual
queries but may have value if we choose the best set of signatures.
"""
import myplot
import util
import signatures
database,dbconnection = util.script_startup('Stats for SQL statments by signature')
queryobj = signatures.groupofsignatures()
lines = util.read_config_file(util.config_dir,database+util.groupsigs_file)
for line in lines:
if len(line) > 0:
queryobj.add_signature(int(line))
querytext = queryobj.build_query()
results = dbconnection.run_return_flipped_results(querytext)
util.exit_no_results(results)
# plot query
myplot.title = "SQL matching group of signatures on "+database+" database elapsed versus executions"
myplot.ylabel1 = "Number of executions"
myplot.ylabel2 = "Averaged Elapsed Microseconds"
myplot.xdatetimes = results[0]
myplot.ylists = results[1:]
myplot.line_2subplots()