In the beginning of each page served by WordPress, there is a MySQL call to fetch options:
SELECT option_name, option_value FROM wp_options WHERE autoload = 'yes';
Because there's no index on autoload
column, MySQL has to lookup ALL rows.
I also came across the comment of this answer saying there would be no performance gain even if there was an index.
In my application, I used a lot of transient values to serve as a session replacement. They worked great and I have my own garbage collection routines. I noticed that in the wp_options
table, my transient values (the ones beginning with _transient_
) all have autoload=no
. I expect the number of rows of my wp_options
table to increase as the number of concurrent user increases.
I'd like to know why the table is designed this way. And should I create an index for my particular case?