EmergencyEMERGENCY? Get 24/7 Help Now!

Google’s user_statistics V2 port and changes

 | September 12, 2008 |  Posted In: Percona Software

PREVIOUS POST
NEXT POST

Recently Google published V2 release of patches, one of them user_statistics we use in our releases.
New features are quite interesting so we decided to port it to fresh releases of MySQL. Features includes:

      New statistics per user (Cpu_time, Bytes_received, Bytes_sent, etc)
      New command SHOW CLIENT_STATISTICS, which shows statistics per client’s hostname, not per user
      FLUSH USER_ and CLIENT_STATISTICS commands

Our port includes:

  • INFORMATION_SCHEMA tables – USER_STATISTICS, CLIENT_STATISTICS, INDEX_STATISTICS, TABLE_STATISTICS
  • Access protection – USER_STATISTICS, CLIENT_STATISTICS available only for user with SUPER or PROCESS privileges. INDEX_STATISTICS, TABLE_STATISTICS shows only information of tables that current user has access to (SELECT privileges required). This is important for hosting providers


Here is example of new tables:

and INDEX/TABLE statistics:

If you would like to test it here is link to patch for 5.0.67.
https://www.percona.com/blog/mysql/experimental/userstatv2.patch. When we consider it stable we will include it in our releases.

Btw working with patches I found very useful utils patchutils, which recommend you if you also need to separate one big patch to several small 🙂

PREVIOUS POST
NEXT POST
Vadim Tkachenko

Vadim Tkachenko co-founded Percona in 2006 and serves as its Chief Technology Officer. Vadim leads Percona Labs, which focuses on technology research and performance evaluations of Percona’s and third-party products. Percona Labs designs no-gimmick tests of hardware, filesystems, storage engines, and databases that surpass the standard performance and functionality scenario benchmarks. Vadim’s expertise in LAMP performance and multi-threaded programming help optimize MySQL and InnoDB internals to take full advantage of modern hardware. Oracle Corporation and its predecessors have incorporated Vadim’s source code patches into the mainstream MySQL and InnoDB products. He also co-authored the book High Performance MySQL: Optimization, Backups, and Replication 3rd Edition.

9 Comments

  • Nice….

    I think the biggest obstacle to V2 adoption is to get the patches into smaller bite size chunks.

    It’s looking like 5.0.67 is the sweet spot though…..with with the Google SMP patches.

    If you can get a build with these patches and your InnoDB performance patches I think this is the release we’ll target.

    There are still some cool V2 features though… I’m going to try to blog about them when I get some time.

  • Kevin,

    What is showed here is not the Googles V2 complete patch set but the given accounting patch ported to Percona patch set. The user statistics patches in particular are very safe because they do not change any internal logic this is why we put them in the “safe to use” release.

  • Couple of comments

    1) It is interesting how much speed overhead if any we got with these patches.
    2) empty_queries is misleading It really means empty_results though I guess it is best if Google renames it so we do not add more differences than needed
    3) Busy Time, CPU time all counted with better accuracy while displayed as seconds only this may not be accurate enough in some cases.
    4) The patch should be counting CPU time per query which can be very nice addition to the processlist schema besides time_ms we have already.

  • @Peter — What is CPU time per query? Select_commands counts all SELECT statements. Update_commands counts all INSERT/UPDATE/REPLACE/DELETE statements and Other_commands counts everything else. Cpu_time / (Select_commands + Update_commands + Other_commands) displays time per client-server protocol command. Do you want Cpu_time for each type of command? The expressions are easy to evaluate since you provide this data via the Information Schema.

  • Peter,

    I realize it wasn’t the complete patch…. I was congratulating you on isolating one of the features from the larger V2 so that it can be easily added to MySQL AB’s sources and moved between versions easier.

    Kevin

  • Get one of our builds. I assume you are using a standard MySQL server. Download our version from https://www.percona.com/percona-lab.html and then see the docs here: https://www.percona.com/docs/wiki/patches:userstatv2

Leave a Reply

 
 

Percona’s widely read Percona Data Performance blog highlights our expertise in enterprise-class software, support, consulting and managed services solutions for both MySQL® and MongoDB® across traditional and cloud-based platforms. The decades of experience represented by our consultants is found daily in numerous and relevant blog posts.

Besides specific database help, the blog also provides notices on upcoming events and webinars.
Want to get weekly updates listing the latest blog posts? Subscribe to our blog now! Submit your email address below and we’ll send you an update every Friday at 1pm ET.

No, thank you. Please do not ask me again.