MySQL vertical output format

Sometimes, especially for tables with lots of fields, the default horizontal output format can take up too much space... particularly if you want to paste the result into an email for example.

By using \G instead of ; to terminate the query, MySQL will use a vertical output format.

Example of normal horizontal format:

mysql> explain select * from Taglines WHERE ID = 3;
+----+-------------+----------+-------+-----------------+---------+---------+-------+------+-------+
| id | select_type | table    | type  | possible_keys   | key     | key_len | ref   | rows | Extra |
+----+-------------+----------+-------+-----------------+---------+---------+-------+------+-------+
|  1 | SIMPLE      | Taglines | const | PRIMARY,FullIDX | PRIMARY |       4 | const |    1 |       |
+----+-------------+----------+-------+-----------------+---------+---------+-------+------+-------+
1 row in set (0.00 sec)

Example of vertical format:

mysql> explain select * from Taglines WHERE ID = 3 \G
*************************** 1. row ***************************
           id: 1
  select_type: SIMPLE
        table: Taglines
         type: const
possible_keys: PRIMARY,FullIDX
          key: PRIMARY
      key_len: 4
          ref: const
         rows: 1
        Extra: 
1 row in set (0.00 sec)

You can also start the mysql client with the –vertical option, which will then affect all queries you perform.

~~DISCUSSION~~

 
mysql/verticaloutput.txt · Last modified: 2010/02/26 10:45 (external edit)
 
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki