Percona Live: MySQL Conference And Expo 2012 – a note on proposals

As a member of the conference committee I review the session and tutorial proposals for the Percona Live MySQL conference in Santa Clara, 2012.

The sessions are expected to be technical, and I’m happy the proposals follow this guideline. I use Giuseppe‘s and Baron‘s general guidelines for submitting a proposal. I wish to humbly add a couple notes myself.

Be fairly brief

Explain your session/tutorial as clearly as you can. The reader should be able to get the general impression of the session from two or three paragraphs. Some can make a point in two sentences; for most it would take somewhat more.

If you’re going to talk about some database feature, for example, please do not write the manual for that feature. That’s for the session itself. Just explain how you’re going to discuss the feature, and why it should be of interest (e.g. what the benefits of this feature are, the risks or pitfalls, the ingenious C code behind it or the quirks of the operating system involved).

Clarify

It’s important for me to understand two things when reading a proposal, which establish the grounds for better evaluating the proposal:

  • Who the target audience is (newbies, developers, DBAs, Linux internal experts etc.)
  • To what depth are you going to deliver the content you describe.

That is not to say you should explicitly state “This session is for MySQL DBAs”, but the attendee should be able to easily decide whether your session appeals to his type of work or expertise. I, myself, have happened upon sessions that were completely different from what I expected. To illustrate, I give two examples, while not disclosing the exact details:

  • A session which was about locking in database. I got the impression it was about ways to avoid locking, issues with mutexes etc. It turned out to be a discussion between the presenter and a few member of the audience about the specific code internals, lines 667-684 in the lock_module.cc file, and the recently reported bug. To me it was more like the weekly rnd meeting of some company. I couldn’t understand anything of the entire talk.
  • A session promising insight on working out great scale-out with some product: I was expecting to hear of the “DOs and DON’Ts”, or of great configuration and implementation tricks on the subject. However, it turned out to be more of a general talk on “how we used the product in our company and found it to work great”.

The two sessions above were perfectly valid, and had their place in the conference. But were poorly described in the two respects I mentioned.

A great submission, in my opinion, is one where attendees get what the expect, and don’t shyly leave the conference room 15 minutes into the talk.

Submit a proposal here.

Reading results of SHOW statements, on server side

SHOW statements are show stoppers on server side. While clients can get a SHOW statement as a result set just as any normal SELECT, things are not as such on server side.

On server side, that is, from within MySQL itself, one cannot:

SELECT `Database` FROM (SHOW DATABASES);

One cannot:

DECLARE show_cursor CURSOR FOR SHOW TABLES;

One cannot:

SHOW TABLES INTO OUTFILE '/tmp/my_file.txt';

So it is impossible to get the results with a query; impossible to get the results from a stored routine; impossible to get the results by file reading…

Bwahaha! A hack!

For some SHOW statements, there is a way around this. I’ve been banging my head against the wall for weeks now on this. Now I have a partial solution: I’m able to read SHOW output for several SHOW statements. Namely, those SHOW statements which allow a LIKE or a WHERE clause.

For example, most are familiar with the following syntax:

USE mysql;
SHOW TABLE STATUS LIKE 'user';

However not so many know that any SHOW statement which accepts LIKE, can also accept WHERE: Continue reading » “Reading results of SHOW statements, on server side”

Xfce is the new Gnome 2

I’ve recently had it with Ubuntu’s Unity.

Wait, why Unity?

Because my gdm was consuming so much CPU my laptop had its fan working non-stop. I’ve researched and tweaked and installed and removed – and finally moved to Unity to solve that. There may have been another solution, but that’s an old story now.

Thing is, that used to be Gnome 2, a great environment for a software developer. Easy keystrokes to move between your apps, intuitive mouse gestures. Unity presented with a very slick look, but a counter-productive environment. Perhaps it’s great for people opening one Firefox window and one Libre Office Writer document. It does not work as well for people with 3 different browsers, 5 terminals on 2 different desktops, eclipse with 4 separate perspectives, and Gimp, which opens up with 5 windows up front. Continue reading » “Xfce is the new Gnome 2”

Quoting text JavaScript/Python style

Unless your MySQL is configured to use ANSI_QUOTES in sql_mode, you are able to quote your text in one of two forms: using single quotes or double quotes:

UPDATE world.Country SET HeadOfState = 'Willy Wonka' WHERE Code='USA'
UPDATE world.Country SET HeadOfState = "Willy Wonka" WHERE Code="USA"

This makes for JavaScript- or Python-style quoting: you quote by your needs. Say you have a text which includes single quotes:

It is what you read when you don’t have to that determines what you will be when you can’t help it. – Oscar Wilde

You wish to insert this text to some tables. You could go through the trouble of escaping it:

INSERT INTO quotes (quote, author) VALUES (
  'It is what you read when you don\'t have to that determines what you will be when you can\'t help it.', 'Oscar Wilde');

or you could just wrap it in double quotes:

INSERT INTO quotes (quote, author) VALUES (
  "It is what you read when you don't have to that determines what you will be when you can't help it.", 'Oscar Wilde');

I find this useful when using SQL to generate queries. Take, for example, eval() for MySQL: the statement: Continue reading » “Quoting text JavaScript/Python style”

Oracle ACE

I am honored to have been nominated for, and to have received the Oracle ACE award.

Nomination for this award is made by Oracle community members, and in this case those being Oracle employees Keith Larson and Dave Stokes. The award is given by Oracle for my involvement in the Oracle/MySQL community and for my contributions.

While open source involvement is generally done in the mere purpose of sharing knowledge and solutions, recognition plays a role in it. For the most part, one who writes blogs wants them to be read, and one who writes code wants it to be downloaded and tested, which is an elemental type of recognition, and what I aim for.

The recognition given by the Oracle ACE award makes for a wonderful complement, being given by the corporate with whose products I’m involved. It is great to get a surprising “Hey, good work” acknowledgement. Sun/MySQL told me that back in 2009, and I was caught utterly unprepared. I am still unprepared!

Thank you, the community, the people from whom I learn and benefit, anyone who ever reads my blogs, who comment, anyone who tries my code, who provides feedback, the multitude of people writing, sharing, blogging, speaking, coding, fixing, spreading, who make it such a great community.

Thank you, Oracle for this award!

Self throttling MySQL queries

Recap on the problem:

  • A query takes a long time to complete.
  • During this time it makes for a lot of I/O.
  • Query’s I/O overloads the db, making for other queries run slow.

I introduce the notion of self-throttling queries: queries that go to sleep, by themselves, throughout the runtime. The sleep period means the query does not perform I/O at that time, which then means other queries can have their chance to execute.

I present two approaches:

  • The naive approach: for every 1,000 rows, the query sleep for 1 second
  • The factor approach: for every 1,000 rows, the query sleeps for the amount of time it took to iterate those 1,000 rows (effectively doubling the total runtime of the query). Continue reading » “Self throttling MySQL queries”

Impressions from Percona Live, London

Am now back from Percona Live, London. Here are some quick impressions of mine.

The physical location of the conference was excellent, not far from Tower Bridge. The conference area itself was nice and has good atmosphere. Very well organized. Kudos to Percona!

Theme

The official theme for the conference was “Discover the Power of MySQL”. However, looking back at the conference, I think the de-facto theme was “High Availability and Scale Out for MySQL”.

Why do I say that? Look at the sponsors of the event; look at the talks. There were talks by and about Clustrix, Tungsten (parallel replication), Schooner, Choosing a HA solution (by Henrik), Fusion-IO, MySQL Cluster, MySQL in the Cloud, Galera Replication, Scalebase, Spider, MHA, Various HA Solutions (by Oli Sennhauser)…

There were other talks, about all sorts of things. But to me it seemed like scale-out was the big thing, and HA the next one. Especially looking at sponsors booths it looked that way.

People

Of course, it’s no secret that meeting the people is a great fun. I met with familiar faces, and was happy to meet new ones. It’s great to just discuss stuff with people, share opinions.

The after party was fun, and well organized. Kudos to Clustrix who sponsored it!

Business talk

I wasn’t at the conference to sell anything myself, and so was on a relaxed mood. I was happy that whatever sales talk I shared, heard or overheard was highly technical and very open. It was also good to openly discuss possible relationships.

I was in particular pleased to see the popularity some of my tools and ideas were gaining. I could recognize at least two talks where my tools were mentioned; I was delighted to talk to DBAs telling me they were using openark-kit in general, oak-online-alter-table in particular, or some SQL solutions and tricks I offered in my blog. This is really wonderful! To write something having people use it to their benefit — I suppose this is what open source aspires to. It’s great to hear feedback, and better yet to get good feedback.

I also had the pleasure of meeting people after hours, and have good discussions, not necessarily MySQL related.

To top it all, I had free time on Wednesday, where I had a superior visit to the Natural History Museum, which left me in awe.

Contest for Glory: write a self throttling MySQL query

What’s all this about?

I’ve you’ve been to my talk in London, then you’ve already got this as homework. If not, allow me to fill in the details:

I was speaking about MySQL’s programmatic nature in many aspects (best if you read the slides!). We discussed user defined variables, derived tables, ordering constructs, order of evaluation, time suspension and time calculation.

An issue I presented was that of a very long running query. Say it runs for 20 minutes. It kills your I/O. Do you KILL the query or wait? It could terminate in 5 seconds from now, and if you kill it now, you lose everything. But it may yet run for 3 more hours!

We discussed a futuristic feature where the query would gracefully terminate after some designated time. However, futuristic wishes do not help us.

A self throttling query

I suggested the idea for a self throttling query. We know how to throttle writing queries, such as DELETE queries: we break them into small chunks, then work each chunk at a time, setting ourselves to sleep in between chunks. This is how –sleep and –sleep-ratio work in oak-chunk-update. It is how –sleep and –sleep-coef work in pt-archiver.

But can the same be done for SELECT queries? Continue reading » “Contest for Glory: write a self throttling MySQL query”

Slides from my talk: “Programmatic Queries: things you can code with SQL”

Here are the slides from my talk Programmatic Queries: things you can code with SQL held on October 25th on the Percona Live event, London.

Programmatic Queries: PDF

I wish to thank those who attended my talk.

The topic of the talk was irregular and, to some extent, controversial. Should one really rely on internal implementation for optimizing her queries? Sergei Golubchik was quick to suggest that even in current and coming versions of MariaDB, some things I spoke about may not hold true. I accept.

I was in urge to complete my talk within the time frame. I was happy to hear later on that my talk was well received.

There were homework to my talk. I thought I would make some contest picking the best answers, stay tuned.

Test-driven SQL development

I’m having a lot of fun writing common_schema, an SQL project which includes views, tables and stored routines.

As the project grows (and it’s taking some interesting directions, in my opinion) more dependencies are being introduced, and a change to one routine or view may affect many others. This is why I’ve turned the development on common_schema to be test driven.

Now, just how do you test drive an SQL project?

Well, much like the way you test any other project in your favorite programming language. If its functions you’re testing, that’s all too familiar: functions get some input and provide some output. Hmmm, they might be changing SQL data during that time. With procedures it’s slightly more complex, since they do not directly return output but result sets.

Here’s the testing scheme I use: Continue reading » “Test-driven SQL development”