T
T
tushev2011-12-25 02:05:01
MySQL
tushev, 2011-12-25 02:05:01

MyISAM vs InnoDB vs Anything

Which data store is better in the following situation?

The social voting application has an AJAX script that is called about 10-50 times per second. It performs the following actions:

- SELECT by primary key
- REPLACE by unique index
- SELECT with JOIN from two tables and sorting. At the same time, LIMIT 1. Specifically, here:

            SELECT p.*, COUNT(g.id)>0 AS my_votes, p.region='{$reg}' AS from_my_region
            FROM person AS p
            LEFT JOIN guess AS g ON p.oid=g.person_oid AND [email protected]
            WHERE p.age>0 AND p.oid<>@myOid AND p.gender<>'{$gender}'
            GROUP BY p.oid
            ORDER BY my_votes ASC, from_my_region DESC, points DESC, is_app_user DESC, RAND()
            LIMIT 1  

I would formulate it this way:
Of heavy operations, one REPLACE accounts for one two-table SELECT JOIN

There are millions of records in the database, and new ones are constantly being added.
All fields that are being selected are indexed.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
L
Lilo, 2011-12-25
@Lilo

MySQL
I would choose

G
Graynder, 2011-12-25
@Graynder

MySQL vs MyISAM Contrasting warm with soft.
It would be more logical to oppose MyISAM vs Innodb
, I would choose MariaDB - there is the Aria engine - MyISAM with transaction support.

B
bolnikh, 2011-12-25
@bolnikh

MyISAM is much faster, and if you don't mind losing some data, you can use it. BUT... MyISAM locks the entire table on insertion - and under some load, something nasty can happen - requests will queue up. So it needs to be tested.
It is better to use an in-memory data store - Redis, memcache - there will be no problems with inserts. But you will have to rewrite the application, the logic of the storage in memory is completely different.

Z
zuborg, 2011-12-27
@zuborg

Most likely, InnoDB will behave better. MyISAM locks the entire table and is only good for light update traffic.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question