Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3622876
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T23:18:49+00:00 2026-05-18T23:18:49+00:00

I have a MEMORY table in MySQL for a live chat (maybe this isn’t

  • 0

I have a MEMORY table in MySQL for a live chat (maybe this isn’t the best table type for this?), and deleting rows every night to keep the chat logs manageable cause overhead in the table. However, since you can’t run OPTIMIZE on a MEMORY table, how do you get rid of the overhead (Data_free in the show table status)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T23:18:50+00:00Added an answer on May 18, 2026 at 11:18 pm

    how do you get rid of the overhead?

    You can force a table using the MEMORY/HEAP storage engine to recover residual space lost from deleted rows by ALTERing it, but not changing anything. e.g.

    ALTER TABLE my_table ENGINE=MEMORY;

    It will re-write the table. Backing that up with a quote from the documentation:

    To free up the memory used by rows
    that have been deleted, use ALTER
    TABLE ENGINE=MEMORY to force a table
    rebuild.

    EDIT

    maybe this isn’t the best table type for this?

    It doesn’t sound like the ideal application of a MEMORY table in my opinion — by and large, I consider it a legacy engine. Some food-for-thought

    Firstly, MEMORY tables can’t/don’t use b-tree indexes (hash indexes only), so queries which could otherwise use an index for ORDERing or ranging (i.e. <, > operations) resort to sorting/filtering manually/exhaustively.

    Secondly, Innodb tables will reside in RAM if your innodb_buffer_pool is large enough, and works better with concurrent threads, so it often performs as good if not better than a MEMORY table for most applications.

    Thirdly, perhaps most importantly, if your MySQL is ever turned off, you’ll lose all data in your table. There are table truncation implications also if you’re using replication.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an MEMORY MYSQL database that contains a table with 200k+ rows. I
I'm using a mysql memory table as a way to cache data rows which
I have a large MySQL table (about 750 million rows) and I just want
Ignoring unsafe code, .NET cannot have memory leaks. I've read this endlessly from many
I have a table in MySql DB which I want to load it to
I have a mysql table with over 4 million of data; well the problem
I have a table with about 3000 records that I query often. Does mysql
We have a large MyISAM table that is used to archive old data. This
How can I NOT have the full result set from mysql copied into memory
I have a denormalized table product with about 6 million rows (~ 2GB) mainly

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.