Search code examples
mysqlmemorydatabase-designstorage-engines

Storage Engine:Memory For Cart Management in eCommerce Site


I am using Storage Engine:Memory for Cart Management in Shopping website. For Inserting, Updating, and Removing Items from Cart.

So My Question is how preferable to use Storage Engine:Memory in MySQL. I know it flashes data when server shutdown. But this table data is useful for only single day. Using Session, my code can be complex so i am thinking about this.

So I need some valuable suggestions.

Thanks in advance.


Solution

  • When the "cart" is lost, the customer is lost. Are you willing to risk it? If not, use InnoDB.

    Complexity of code should not be much different; what concerns you?

    When does a "day" end? At midnight on your server? What if someone on the other side of the world is starting a cart just before your midnight?

    On the other hand, it may be wise to store credit card numbers (and other sensitive info) in MEMORY as a small step toward security. If so, store it in a separate table so only that is lost.