Skip to content

Instantly share code, notes, and snippets.

@graffic
Created May 16, 2011 20:01
Show Gist options
  • Save graffic/975224 to your computer and use it in GitHub Desktop.
Save graffic/975224 to your computer and use it in GitHub Desktop.
Corrected Zabbix proxy 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 inner join items i on h.hostid=i.hostid
right outer join proxy_history p on i.itemid=p.itemid
where p.id>21824754 order by p.id limit 10\G
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: p
type: range
possible_keys: PRIMARY,id
key: PRIMARY
key_len: 8
ref: NULL
rows: 1011520
Extra: Using where
*************************** 2. 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:
*************************** 3. row ***************************
id: 1
select_type: SIMPLE
table: h
type: eq_ref
possible_keys: PRIMARY
key: PRIMARY
key_len: 8
ref: zabbix_proxy.i.hostid
rows: 1
Extra:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment