From 784893932b18ee7bc17ec066767fa127e7f8348b Mon Sep 17 00:00:00 2001 From: Tim Denike Date: Tue, 21 Jun 2011 23:55:14 +0000 Subject: [PATCH] add a page that displays all queries that reference a particular table --- explain.php | 1 + explain.tpl | 3 +++ table.php | 34 ++++++++++++++++++++++++++++++++++ table.tpl | 19 +++++++++++++++++++ 4 files changed, 57 insertions(+) create mode 100644 table.php create mode 100644 table.tpl diff --git a/explain.php b/explain.php index 1044018..8f60e93 100644 --- a/explain.php +++ b/explain.php @@ -6,6 +6,7 @@ require_once('init.php'); $checksum = $_GET['checksum']; + $hours = $_GET['hours']; $q = "SELECT * FROM {$host_conf['db_query_review_history_table']} WHERE checksum = '{$checksum}'"; $result = mysql_query($q); diff --git a/explain.tpl b/explain.tpl index bbbf85c..c4d70cb 100644 --- a/explain.tpl +++ b/explain.tpl @@ -13,7 +13,10 @@ class="alt"> $value): ?> + + + diff --git a/table.php b/table.php new file mode 100644 index 0000000..43b83c4 --- /dev/null +++ b/table.php @@ -0,0 +1,34 @@ + date_sub(now(),interval {$hours} hour) + group by t.checksum order by count desc"; + + $result=mysql_query($q); + + $rows = array(); + while ($row = mysql_fetch_assoc($result)) { + $row['explain_url'] = "explain.php?" . ish_build_query(array('checksum'=>$row['checksum'])); + $rows[] = $row; + } + + require("table.tpl"); + diff --git a/table.tpl b/table.tpl new file mode 100644 index 0000000..5abdaed --- /dev/null +++ b/table.tpl @@ -0,0 +1,19 @@ + +

+

+

More queries on table

+ + + + + + + + class="alt"> + + + + + +
CountQueryExplain
explain
+