Skip to content

Instantly share code, notes, and snippets.

@graffic
Created May 16, 2011 19:51
Show Gist options
  • Save graffic/975190 to your computer and use it in GitHub Desktop.
Save graffic/975190 to your computer and use it in GitHub Desktop.
Zabbix proxy item query
mysql> explain select p.id,h.host,i.key_,p.clock,p.timestamp,
p.source,p.severity,p.value,p.logeventid
from hosts h,items i,proxy_history p where h.hostid=i.hostid
and i.itemid=p.itemid and p.id>21824754 order by p.id limit 1000\G
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: p
type: range
possible_keys: PRIMARY,id
key: PRIMARY
key_len: 8
ref: NULL
rows: 1446768
Extra: Using where; Using temporary; Using filesort
*************************** 2. row ***************************
id: 1
select_type: SIMPLE
table: h
type: index
possible_keys: PRIMARY
key: hosts_1
key_len: 66
ref: NULL
rows: 5
Extra: Using index; Using join buffer
*************************** 3. row ***************************
id: 1
select_type: SIMPLE
table: i
type: eq_ref
possible_keys: PRIMARY,items_1
key: PRIMARY
key_len: 8
ref: zabbix_proxy.p.itemid
rows: 1
Extra: Using where
3 rows in set (0.05 sec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment