My favorites | Sign in
Logo
                
Search
for
Updated Jul 24, 2009 by dan...@percona.com
EventAttributes  
List of possible event attributes

Events can have the attributes (a.k.a. attribs, properties or props) listed below. Some attributes are only available in certain input. For example, Warning_count is only available in tcpdump input. Even then, an attribute is only available if it actually appeared in the input or could be calculated. Therefore, do not always assume that an attribute is available.

Versions of mk-query-digest after r3968 auto-detect and print almost all attribs that it discovers. Certain properties are ignored; see mk-query-digest's default value for --ignore-attributes.

Attribute Classes

There are four classes of attributes: internal, normal, SET and Percona-patch.

Internal attribs do not appear in the input (i.e. the slow log, tcpdump, or processlist) but are created by the event parsing module (i.e. SlowLogParser, MySQLProtocolParser, Processlist, MemcachedEvent). Internal attribs help accomplish various things inside the code. They are generally ignored by the user. Once exception is memcached attributes; see below.

Normal attribs do appear in the input; they are the ones with which you're most familiar: Query_time, Lock_time, etc. These attributes come from the event's header.

SET attribs also appear in the input but unlike normal attributes they do not appear in the event's header. Rather, they are attributes from SET statements. The statement SET insert_id=123; creates an insert_id attribute with value 123.

Percona-patch attribs are also appear in the input and the event's header but only if you're using a Percona-patched server or Percona binary.

Knowing these attributes can help you write fancy --filter subs for mk-query-digest or know which attributes to --select or --ignore-attributes.

memcached

As of roughly r4159, mk-query-digest can parse memcached data from a tcpdump (mk-query-digest --type memcached). Several memcached attributes come from the protocol, like cmd, key, val and res. These are generally not used by the user and so they're listed as internal attributes. But from these several normal attributes are created which begin with "Memc".

Internal attributes

Attribute Input Description
arg All The query text, or, in case it's an admin command like Ping, the command.
bytes All The byte length of the arg.
cmd All "Query" or "Admin" for all except memcached. For memcached it's the memcached command (get, set, etc.).
exptime memcached Expiration time.
flags memcached
key memached The key used by cmd.
key_print memcached An abstracted form of the key.
pos_in_log All except Processlist The byte offset of the event in the log or tcpdump.
fingerprint All An abstracted form of the query.
res memcached Result of cmd.
ts All The timestamp of the query. ts is from the Time normal attribute in slow logs, and it's the time when the query ended. See also the SET timestamp attribute.
val memcached The return value of cmd, if any.

Normal attributes

Attribute Input Description
db All except memcached Current database. Comes from USE database statements in logs. See also Percona-patch Schema attribute.
Error_no tcpdump The error number if any.
host All Client host which executed the query.
id Processlist Process ID.
ip Log, tcpdump Client IP.
Lock_time Log Time the query was locked before it was able to start executing.
Memc_add memcached Yes/No if the command is add.
Memc_append memcached Yes/No if the command is append.
Memc_cas memcached Yes/No if the command is cas.
Memc_error memcached Yes/No if command caused an error. Currently, the only error is when a retrieval command is interrupted.
Memc_get memcached Yes/No if the command is get.
Memc_gets memcached Yes/No if the command is gets.
Memc_miss memcached Yes/No if the command tried to access a nonexistent key.
Memc_prepend memcached Yes/No if the command is prepend.
Memc_replace memcached Yes/No if the command is replace.
Memc_set memcached Yes/No if the command is set.
No_good_index_used, No_index_used tcpdump Yes/No properties set by status flags sent by server.
port tcpdump Client port.
Rows_sent, Rows_examined, Rows_affected, Rows_read Log Self-explanatory.
user Log User who executed the query.
Query_time All The total time the query took, including lock time.
Warning_count tcpdump The number of warnings.

Common SET attributes

Attribute Input Description
insert_id Log Self-explanatory.
timestamp Log The time at the start of the query. In a replication slave, this could be something unrelated to the time of execution. See also ts internal attribute.

Percona-patch attributes

The most up-to-date documentation on the Percona patches should be found at http://www.percona.com/docs/wiki/patches:microslow_innodb, but we list them below in an abbreviated form.

Attribute Input Description
Disk_filesort Log Yes/No if the query's filesort was done on disk.
Disk_tmp_table Log Yes/No if query used a temporary table on disk.
Filesort Log Yes/No if query used a filesort.
Full_scan Log Yes/No if query caused a full table scan.
Full_join Log Yes/No if query caused a full join.
InnoDB_IO_r_ops Log
InnoDB_IO_r_bytes Log
InnoDB_IO_r_wait Log
InnoDB_rec_lock_wait Log
InnoDB_queue_wait Log
InnoDB_pages_distinct Log
Merge_passes Log Number of merge passes to sort query.
QC_Hit Log Yes/No if query was served from query cache.
Schema Log The current database. See also the db normal attribute.
Thread_id Log Self-explanatory.
Tmp_table Log Yes/No if query used a temporary table in RAM.

Hosted by Google Code