Jump to content

Recommended Posts

Hey everybody,

I have a site that is pushing 1M users with ~2M pageviews per day.  It's built on a form of artificial currency and involves a lot of transactions of this artificial currency.  I log every monetary transaction into one table that, as you can imagine, is rather large (32M rows).  I move old transactions daily into a non-live table to keep the size manageable, but here's my issue.  I intentionally didn't build indexes in this table because it is only ever read from the MySQL monitor.  It is only written to by users, so read does not need to be quick.  The problem is that when I do need to read it (maybe twice a day) it takes FOREVER to query because it has to go through every row.  So I'm wondering two things:

 

1.  Should this table be InnoDB or MyISAM?

2.  How much of a performance hit will I take if I build indexes on the table?

Link to comment
https://forums.phpfreaks.com/topic/80297-myisam-vs-innodb-use-case/
Share on other sites

yeah, it's going to be painful to do this without an index.  I would suggest a covering index on (user_id, trans_type) -- it will take forever to build this the first time, but there shouldn't be too much of a performance hit during normal operations... how many insert/s?

I've never used INSERT DELAYED actually, so I'm not sure if I can afford it or not.  As I understand it, MySQL will bundle a bunch of inserts together to throw in at one time.  Seems that might actually speed things up.

It only matters if you're going to using the UID you get back from the insert immediately; or it could be delayed a while if there was a read lock (but that would happen anyway even with a regular insert).

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.