table in Drupal database was configured to be optimized but does not exist.
jerome72 - November 17, 2008 - 12:06
| Project: | DB Maintenance |
| Version: | 6.x-2.0-beta2 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
I can't use this module because for each table I selected, when I execute /admin/settings/db_maintenance, Drupal says "Database tables optimized", but When I check table watchdog in phpmyadmin, I can see it has not been optimized at all.
If I check DB_maintenance log, for each table I selected it says :
Of course, theses tables exist, as DB maintenance retrieves them from my database.
Thanks for support

#1
#2
I think I know what the issue is, are you using table prefixes?
#3
Hi jgraham,
Thanks for the reply, sorry to be so late!
Yes I do use table prefixes, is it a problem ?
#4
Hi,
I seem to be having the same problem. Have selected the tables to run daily, and even if I do it manually, it has not optimized in phpmyadmin .. (:
Yes, also use table prefixes : drupal_
Is that perhaps what is causing this please?
Look forward to any reply.
Lilian
#5
Hi,
I updated to latest version, but still receive error logs:
eg. drupal_views_object_cache table in Drupal database was configured to be optimized but does not exist
I do use a table prefix : drupal_
Is there a way to fix this please?
Look forward to any reply and thank you for your great module.
Lilian
#6
When I use database tables without prefix, All tables Optimized OK, but with using any tables prefix for not !!!
After manually or by cron optimized Dupal says Database tables optimized, but look in Phpadmin optimized no tables.
#7
Any news please? as this is a much needed module ..
drupal_views_object_cache table in Drupal database was configured to be optimized but does not exist
Thanks so much!
#8
Yep, having the same issue, example -
drupal_wlw_blogapi_files table in Drupal database was configured to be optimized but does not exist.,drupal_wlw_blogapi_files table in Drupal database was configured to be optimized but does not exist.
#9
I've figured out the issue. If I can figure out how to post a .patch file I will. Here is the offending code section:
in db_mainenance.module line 155-165
$config_tables = variable_get('db_maintenance_table_list_'. $db, NULL);// Only proceed if tables are selected for this database.
if (is_array($config_tables) && count($config_tables) > 0) {
$db_name = $db == 'default' ? 'Drupal' : $db;
while (list(, $table_name) = each($config_tables)) {
// Set the database to query.
$previous = db_set_active($db);
if (db_table_exists($table_name)) {
if (_db_maintenance_determine_software() == 'mysql') {
$result = db_query('OPTIMIZE TABLE %s', $table_name);
$status = db_fetch_array($result);
When you are using a drupal database prefix, the code calls 'db_table_exists' with the prefix included (i.e db_table_exists("myprefix_node" ). The correct syntax for this call is to use the raw drupal database name (i.e. db_table_exists("node") )
The code below needs to be added directly before the _db_maintenance_determine_software call:
// Setup for database exists check...have to strip out $db_prefix due to db_table_exists expecting non prefixed tablenames.global $db_prefix;
if (strlen($db_prefix)>0) {
//database has a prefix
$table_check_name = str_replace($db_prefix,'',$table_name);
}
if (db_table_exists($table_check_name)) {
So the final code should look like the following:
$config_tables = variable_get('db_maintenance_table_list_'. $db, NULL);// Only proceed if tables are selected for this database.
if (is_array($config_tables) && count($config_tables) > 0) {
$db_name = $db == 'default' ? 'Drupal' : $db;
while (list(, $table_name) = each($config_tables)) {
// Set the database to query.
$previous = db_set_active($db);
// Setup for database exists check...have to strip out $db_prefix due to db_table_exists expecting non prefixed tablenames.
global $db_prefix;
if (strlen($db_prefix)>0) {
//database has a prefix
$table_check_name = str_replace($db_prefix,'',$table_name);
}
if (db_table_exists($table_check_name)) {
if (_db_maintenance_determine_software() == 'mysql') {
$result = db_query('OPTIMIZE TABLE %s', $table_name);
$status = db_fetch_array($result);
#10
I am experiencing the same issue, using db prefixes. I was hoping that spamsammy's patch would work but I'm still getting the same "does not exist" error message (btw, the table name referenced in the "does not exist" is the correct table name.)