Here is the comparison between mysql and postgresql for selects (only). I had used the same table that i had created earlier http://jayant7k.blogspot.com/2010/09/database-speed-tests-mysql-and.html while comparing insertion speed. I have created approximately 1,000,000 records in the table and ran selects on them. I also modified the configuration of both mysql and postgresql to enable faster
Update: Also read A brief update on NUMA and MySQL.
The “swap insanity” problem, in brief
When running MySQL on a large system (e.g., 64GB RAM and dual quad core CPUs) with a large InnoDB buffer pool (e.g., 48GB), over time, Linux decides to swap out potentially large amounts of memory, despite appearing1 to be under no real memory pressure. Monitoring reveals that at no time is the system in actual need of more memory than it has available; and memory isn’t leaking, mysqld‘s RSS is normal and stable.
Normally a tiny bit of swap usage could be OK (we’re really concerned about activity—swaps in and out), but in many cases, “real” useful memory is being swapped: primarily parts of InnoDB’s buffer pool. When it’s needed …
[Read more]Internally MySQL uses various methods to manage (or, block) concurrent access to shared structures within the server - the most common being mutexes (or Mutual Exclusion locks), RW Locks, or Semaphores. Each have slightly different properties on how different threads are allowed to interact when trying to access these synchronization points.
There has been much written on the various hot spots in the server around these locking/blocking constructs over the past couple of years, so I won’t go further in to that here. See the excellent blogs from Mikael or Dimitri from within …
[Read more]Yesterday, I reached a happy milestone in HailDB development. All compiler warnings left in the api/ directory (the public interface to the database engine) are now either probable/possible bugs (that we need to look at closely) or are warnings due to unfinished code (that we should finish).
There’s still a bunch of compiler warnings that we’ve inherited (HailDB compiles with lots of warnings enabled) that we have to get through, but a lot will wait until after we update the core to be based on InnoDB 1.1.
We quite often say, that benchmark performance is usually different from real world performance – so performance engineering usually has to cover both – benchmarks allow to understand sustained performance bottlenecks, and real world analysis usually concentrates on something what would be considered ‘exceptional’ and not important in benchmarks – stalls of various kind. They are extremely important, as the state when our performance is lowest is the state of performance we provide to our platform users.
On a machine that is doing 5000qps, stalling for 100ms means that 500 queries were not served as fast as they could, or even hit application timeouts or exceptional MySQL conditions (like 1023 transaction limit). Of course, stalling for a second means 5000 queries were not served in time…
We have multiple methods to approach this – one is our …
[Read more]I occasionally get in to light arguments healthy discussions with students about whether or not to use Foreign Key constraints on InnoDB tables. My standard response has always been: “it depends on how much of a tradeoff you are willing to make for performance. In some situations the cost can be considerable”.
.. that’s when they expect me to “come up with some real proof” to show them. I do not disagree with their logic or proof being on their list-of-demands. I support the use of data to make decisions.
The problem is that MySQL has (traditionally) been lacking the instrumentation required to make these decisions easy. This is getting better – here is an example we recently added to our InnoDB course:
CREATE TABLE parent ( id INT NOT …[Read more]
The Drupal community just recently released another alpha test release of their upcoming Drupal 7 version, to shake out the remaining bugs and to encourage more users to test it.
If you would like to give it a try, but you don't have a free server handy, how about using a virtual machine instead? Using the fabolous SuSE Studio, I've created an appliance based on openSUSE 11.3, Drupal 7.0-alpha7 and MySQL 5.1 with the InnoDB plugin and strict mode enabled (both for the …
[Read more]Why should you convert myisam tables to innodb ?
For the perfectly simple reason that innodb tables do not get locked by concurrent selects & inserts. So if you find that your myisam table is suffering for too many locks - due to concurrent selects and inserts, it is time for you to covert the table to innodb.
The simple query which does the trick is
Alter table myisam_table_name engine =
Clients often ask what the differences are between the various InnoDB isolation levels, or what ACID means. Here are some simple explanations for those that have not yet read the manual and committed it to memory.
READ UNCOMMITTED
Every select operates without locks so you don’t get consistency
and might have dirt reads, which are potentially earlier versions
of data. So, no ACID support here.
READ COMMITTED
Has consistent reads without locks. Each consistent read, even
within the same transaction, sets and reads its own fresh
snapshot.
REPEATABLE READ
The InnoDB default isolation level for ACID compliance. All reads
within the same transaction will be consistent between each other
– ie, the C in ACID. All writes will be durable, etc etc.
SERIALIZABLE
Same as REPEATABLE READ but MySQL converts regular select …
How long it may take MySQL with Innodb tables to shut down ? It
can be quite a while.
In default configuration innodb_fast_shutdown=ON
the main job Innodb has to do to complete shutdown is flushing
dirty buffers. The number of dirty buffers in the buffer pool
varies depending on innodb_max_dirty_pages_pct
as well as workload and innodb_log_buffer_size
and can be anywhere from 10 to 90% in the real life workloads.
Innodb_buffer_pool_pages_dirty status will show
you the actual data. Now the flush speed also depends on number
of factors. First it is your storage configuration – you may be
looking at less than 200 writes/sec for single entry level hard
drive to tens of thousands of writes/sec for high end SSD card.
Flushing can be done using multiple threads (in XtraDB and Innodb
Plugin at least) so it scales well with multiple hard drives. The
second important variable is your …