A wpoptions table that is bloated and contains a lot of unnecessary autoloaded data is one of the leading causes of your WordPress website being slow. This article will provide detailed instructions on how to clean up the wpoptions WordPress table safely and effectively, from using simple plugins for beginners to powerful SQL queries for advanced users, helping you optimize the database and speed up your WordPress website instantly.

Why Does the wp_options Table Make Your WordPress Website Slow?
The wp_options table slows down the website because it contains autoloaded data that is loaded on every page; When this table swells, the server has to process huge amounts of data unnecessarily, increasing response time (TTFB) and degrading website performance.
What is the wp_options table? Roles and structures
Bảng wp_options là nơi lưu trữ các cài đặt cốt lõi của WordPress, theme và plugin, với các cột quan trọng như option_id, option_name, option_value và autoload.
Trong kiến trúc database WordPress, wp_options đóng vai trò như một trung tâm điều khiển. Bất cứ khi nào bạn thay đổi cài đặt URL, kích hoạt một plugin mới, hoặc lưu cấu hình giao diện, dữ liệu đều được ghi vào đây. Cấu trúc của bảng này khá đơn giản nhưng lại cực kỳ quan trọng, bao gồm 4 cột chính:
option_id: Số thứ tự định danh duy nhất cho mỗi hàng.option_name: Tên của tùy chọn (ví dụ:siteurl,home,active_plugins).option_value: Giá trị thực tế của tùy chọn đó (có thể là văn bản thường hoặc chuỗi dữ liệu được mã hóa).autoload: Cột quyết định xem dữ liệu có được tự động tải lên bộ nhớ cache mỗi khi có người truy cập hay không (nhận giá trịyeshoặcno).
Understanding this structure is a stepping stone for you to know how to clean up the WordPress wp_options table without damaging the database.
"Autoload data" - The hidden culprit that slows down websites
Autoload data are options with a "yes" value in the autoload column, forcing WordPress to load them every time someone visits, causing memory exhaustion if the 1MB limit is exceeded.
Theo các cập nhật mới nhất về hiệu suất tính đến đầu năm 2026, dữ liệu autoload chính là "kẻ thù thầm lặng" của tốc độ tải trang. Khi một tùy chọn được đặt là autoload = 'yes', WordPress sẽ tự động truy vấn và nạp nó vào bộ nhớ (object cache) trên mọi trang mà người dùng truy cập.
At Pham Hai: Personal Blog, we find that the ideal limit for total autoload capacity should be below 800KB. If this number exceeds 1MB or even 2MB, the server will have to work too hard to handle the excess amount of data, leading to a situation where wpoptions are full and causing a 502 Bad Gateway error. optimizing wp autoloadoptions is a mandatory task if you want a smooth website.
The main reasons why the wp_options table is bloated and overloaded
The main cause comes from installing and deleting many plugins/themes without cleaning up redundant data, the accumulation of expired transients, and stored sessions from WooCommerce.
During the administration process, there are many reasons leading to database bloat, specifically:
- Rác từ Plugin và Theme: Rất nhiều theme WordPress và plugin khi bị gỡ cài đặt không tự động xóa dữ liệu thừa wp_options. Chúng để lại các hàng ngàn dòng
option_namevô giá trị. - Transient không tự xóa: Transient là dạng dữ liệu tạm thời (như kết quả truy vấn API, cache đếm số lượt chia sẻ mạng xã hội). Khi hết hạn, nhiều transient không tự biến mất mà mắc kẹt lại, tạo thành dữ liệu rác WordPress.
- Session của WooCommerce: Nếu bạn đang chạy một cửa hàng trực tuyến, tình trạng wp_options woocommerce bị phình to rất dễ xảy ra do hệ thống liên tục tạo ra các session WordPress cho giỏ hàng của khách vãng lai nhưng không dọn dẹp kịp thời.
Completely resolving these causes not only helps to reduce the database but is also an important part of the comprehensive increasing WordPress website speed strategy.
Detailed Instructions on How to Clean and Optimize the wp_options Table

The cleaning process includes 3 steps: diagnosing the current size, using an automatic plugin for newbies, or deep intervention with SQL commands for experienced administrators.
Step 1: Check the "health" of your wp_options table (Diagnostics before processing)
You can check the wp_options table size using Query Monitor or run an SQL command in phpMyAdmin to see how much total autoload data is taking up.
Before embarking on cleaning wpoptions wordpress, you need to check the wpoptions table size to know the condition. There are two ways to do it:
Cách 1: Sử dụng Plugin Query Monitor Đây là công cụ chẩn đoán tuyệt vời. Sau khi cài đặt, bạn có thể xem trực tiếp tổng dung lượng database và các truy vấn chậm ngay trên thanh admin bar. Nếu thấy thời gian truy vấn bảng options quá lâu, đó là lúc cần hành động. Việc phát hiện sớm các truy vấn bất thường cũng là một bước cơ bản để khắc phục lỗi wordpress kịp thời.
Cách 2: Sử dụng phpMyAdmin (Đề xuất) Đăng nhập vào phpMyAdmin từ bảng điều khiển hosting của bạn, chọn database đang sử dụng và chạy SQL query sau trong tab SQL để kiểm tra dung lượng autoload:
SELECT SUM(LENGTH(option_value)) / 1024 / 1024 AS autoload_mb FROM wp_options WHERE autoload='yes';
Đánh giá kết quả tính bằng MB:
- Dưới 0.8 MB (800KB): Rất tốt.
- Từ 1 MB đến 2 MB: Cần chú ý và bắt đầu dọn dẹp.
- Trên 2 MB: Báo động đỏ, cần fix wp_options chậm ngay lập tức.
Step 2: Clean up safely and quickly with a Plugin (Method for newbies)
Using database optimization plugins like WP-Optimize or Advanced Database Cleaner helps you easily delete transients, clean up junk data, and optimize tables with just a few mouse clicks.
If you are not confident with the code, cleaning wp_options with a plugin is the safest solution. These tools are designed to automatically identify and remove redundant components.
- WP-Optimize: Đây là plugin phổ biến nhất. Bạn chỉ cần vào giao diện của plugin, chọn các mục như "Remove expired transient options" (xóa transient wp_options) và chạy tối ưu.
- Advanced Database Cleaner: Plugin này cực kỳ mạnh mẽ trong việc dọn dẹp "mồ côi" (orphaned data). Ở phiên bản Pro, nó có thể quét bảng
wp_optionsvà phân loại rõ ràng đâu là dữ liệu của plugin đang hoạt động, đâu là tàn dư của plugin đã xóa, giúp bạn giảm dung lượng bảng wp_options một cách chính xác.
In addition to optimizing the database, to achieve maximum website speed, you should incorporate caching solutions at the server level. Properly configuring litespeed cache wordpress will significantly reduce the load on the database by caching frequent queries.
Step 3: In-depth optimization using SQL queries (For experienced users)
Using phpMyAdmin or WP-CLI, you can run SQL queries to find, change autoload status to "no", or permanently delete old options that are no longer in use.
For experienced administrators, cleaning wp_options with sql offers absolute control. This process helps optimize the mysql wordpress database at the deepest level.
Tìm các option có dung lượng lớn nhất: Chạy lệnh sau để liệt kê top 20 tùy chọn đang "ăn" nhiều dung lượng autoload nhất:
SELECT option_name, LENGTH(option_value) / 1024 AS size_kb FROM wp_options WHERE autoload='yes' ORDER BY LENGTH(option_value) DESC LIMIT 20;
Xử lý dữ liệu:
Sau khi xác định được các option_name bất thường (thường có tiền tố của các plugin đã gỡ bỏ), bạn có hai hướng giải quyết:
- Chuyển autoload thành "no" (An toàn): Thay vì xóa ngay, hãy thử tắt tính năng tự động tải của chúng bằng lệnh:
sql UPDATE wp_options SET autoload = 'no' WHERE option_name = 'ten_option_dang_nghi_ngo';Sau vài ngày, nếu website vẫn hoạt động bình thường, bạn có thể tiến hành xóa option cũ đó. - Xóa vĩnh viễn (Triệt để):
sql DELETE FROM wp_options WHERE option_name = 'ten_option_rac';
Additionally, for large systems, administrators often use the WP-CLI command line interface to perform automated cleanups more quickly without opening the browser.
Important Notes and Precautions
To be safe, you should always back up your database before operations and set up regular maintenance routines to prevent wp_options from bloating again.
optimizing wpwordpress options is a continuous process. If you do it wrong, you may face a very complicated fixing broken wpoptions error.
Always back up the database before making any changes
Interfering with the database always poses a risk, so creating a complete backup helps you easily restore your website if you accidentally delete important data.
Tại Phạm Hải: Blog cá nhân, nguyên tắc bất di bất dịch của chúng tôi là: Không bao giờ chạm vào MySQL nếu chưa có bản backup. Khi chạy các lệnh xóa trực tiếp, chỉ một sai sót nhỏ ở mệnh đề WHERE cũng có thể làm sập toàn bộ trang web.
Use your WordPress hosting's built-in backup features, or use plugins like UpdraftPlus. If you are not familiar with this process, immediately refer to the detailed instructions on how to safely backup a wordpress website before proceeding with the cleanup.
Tip to help prevent the wp_options table from bloating in the future
Avoid installing plugins indiscriminately, clean the database periodically, reconfigure wp-config.php and use the OPTIMIZE TABLE command to maintain a healthy database index.
To avoid having to constantly clean up, you should apply the following good habits:
- Giới hạn số lượng Revisions và dọn rác tự động: Thêm đoạn mã
define('WP_POST_REVISIONS', 5);vào file wp-config.php để giới hạn bản nháp. Thiết lập plugin dọn dẹp chạy tự động hàng tuần để xóa cache WordPress và transient cũ. - Kiểm tra kỹ trước khi dùng Plugin: Chỉ cài đặt những plugin thực sự cần thiết và đến từ các nhà phát triển uy tín.
- Chống phân mảnh bảng: Sau khi xóa một lượng lớn dữ liệu, cơ sở dữ liệu sẽ bị phân mảnh. Hãy chạy lệnh OPTIMIZE TABLE
wp_options;trong phpMyAdmin để sắp xếp lại cấu trúc lưu trữ và làm mới index database, giúp các truy vấn diễn ra nhanh hơn.
Cleaning and optimizing the wpoptions table is not a one-time job but should be done periodically. By applying methods from using plugins to running SQL commands as instructed, you can effectively control "junk data" and autoload data. Thereby, you not only speed up your WordPress website by optimizing wpoptions but also maintain the stability and highest performance of your system.
If you have any questions or need professional help to clean up the wp_options wordpress table and optimize your website, don't hesitate to contact us for advice!
Lưu ý: Các thông tin trong bài viết này chỉ mang tính chất tham khảo. Để có lời khuyên tốt nhất, vui lòng liên hệ trực tiếp với chúng tôi để được tư vấn cụ thể dựa trên nhu cầu thực tế của bạn.