Following our events earlier this year in Raleigh, Montevideo, Buenos Aires, Toronto and Portland, we bring Percona University to …
[Read more]For people used to relational databases, using NoSQL solutions such as MongoDB brings interesting challenges. One of them is schema design: while in the relational world, normalization is a good way to start, how should we design our collections when creating a new MongoDB application?
Let’s see with a simple example how we would create a data structure for MySQL (or any relational database) and for MongoDB. We will assume in this post that we want to store people information (their name) and the details from their passport (country and validity date).
Relational Design
In the relational world, the basic idea is to try to stick to the 3rd normal form and create two tables (I’ll omit indexes and foreign keys for clarity – MongoDB supports indexes but not foreign keys):
mysql> select * from people; +----+------------+ | id | name | +----+------------+ | 1 | Stephane | | 2 | John | | 3 | …[Read more]
This is part 3 of a 3 part series covering the new InnoDB full-text search features in MySQL 5.6. To catch up on the previous parts, see part 1 or part 2
Some of you may recall a few months ago that I promised a third part in my InnoDB full-text search (FTS) series, in which I’d actually take a look at the performance of InnoDB FTS in MySQL 5.6 versus traditional MyISAM FTS. I hadn’t planned on quite such a gap between part 2 and part 3, but as they say, better late than never. Recall that we have been working with two data sets, one which I call SEO (8000-keyword-stuffed web pages) and the other which I call DIR (800K directory records), and we are comparing MyISAM FTS in …
[Read more]If we have InnoDB pages there are two ways to learn how many records they contain:
- PAGE_N_RECS field in the page header
- Count records while walking over the list of records from infimum to supremum
In some previous revision of the recovery tool a short summary was added to a dump which is produced by the constraints_parser.
But if a page is lost and page_parser hasn’t found it, all records from this page are lost. In other words per-page recovery statistics gives us little idea about whether or not a recovered table is complete.
To cover this flaw a new tool index_check is introduced in …
[Read more]In writing a recommendation for our Web development team on how to use MySQL, I came up with the following list, which I want to share: What kind of queries are bad for MySQL?
- Any query is bad. Send a query only if you must. (Hint: use caching like memcache or redis)
- Queries that examine many rows are bad. Try instead to
use…
SELECT col1 FROM table1 WHERE primary_key_column=SOMETHING
. Or at least
secondary_key_column=SOMETHING
. If it is still not possible, try to make the query examine the least amount of rows possible (zero is ideal, as we come to the first case here) - Queries with JOINS are bad. Try to denormalize the table to
avoid JOINS. Example: original query
SELECT t2.value FROM t2 JOIN t1 ON (t1.id=t2.tid) WHERE t1.orderdate=NOW()
. This can be denormalized by copying the column orderdate from table …
There are different articles on how to setup MySQL with SSL but it’s sometimes difficult to end up with a good simple one. Usually, setting up MySQL SSL is not really a smooth process due to such factors like “it’s not your day”, something is broken apparently or the documentation lies I am going to provide the brief instructions on how to setup MySQL with SSL, SSL replication and how to establish secure connections from the console and scripts showing the working examples.
Quick links:
[Read more]Thanks to everyone who was in attendance on 05 June 2013 for my “Choosing a MySQL HA Solution” webinar. If you weren’t able to make it but are interested in listening to the presentation, it’s currently up and available for viewing over at percona.com.
My apologies if we weren’t able to get to your question during the initial session, so I’ll address those lingering questions in this post, along with providing a bit more detail on some of the questions that I did cover during the session.
Q: What is the reason that I recommended DRBD be used only on
physical hardware and not on virtual machines?
A: I covered this a bit during the session, but to provide
a bit more commentary. There …
Lately I have been working with a set of customers on a longer term basis which has given me time to explore new tools using their environments. One tool that I am finding very helpful is called SchemaSpy.
SchemaSpy is a Java-based tool (requires Java 5 or higher) that analyzes the metadata of a schema in a database and generates a visual representation of it in a browser-displayable format. It lets you click through the hierarchy of database tables via child and parent table relationships as represented by both HTML links and entity-relationship diagrams. It’s also designed to help resolve the obtuse errors that a database sometimes gives related to failures due to constraints.
One of the …
[Read more]On Friday I gave a presentation on “MySQL Query Patterns, Optimized” for Percona MySQL Webinars. If you missed it, you can still register to view the recording and my slides.
Thanks to everyone who attended, and especially to folks who asked the great questions. I answered as many as we had time for during the session, but here are all the questions with my complete answers:
Q: Can you compare the use of subqueries/multiple joins vs. multiple queries (e.g. temp tables)?
For performance, it’s hard to make …
[Read more]
Today’s blog post diving into the waters of the MySQL buffer
pool is a cross-post from Groupon’s engineering blog, and is Part 1 of
2. Thank you to Kyle Oppenheim at Groupon for contributing to
this project and post. We’ll be posting Part 2 on Thursday. I’ll
be at the Percona Live MySQL Conference and Expo next
week in Santa Clara, California so look for me there – I’d love
to connect and talk more about MySQL buffer pools or anything
else that’s on your mind!
There …
[Read more]