Title: Database setup / DBTable improvements
Last modified: June 5, 2025

---

# Database setup / DBTable improvements

 *  Resolved [mb00](https://wordpress.org/support/users/mb00/)
 * (@mb00)
 * [10 months, 1 week ago](https://wordpress.org/support/topic/database-setup-dbtable-improvements/)
 * Currently plugin performs `SHOW TABLES LIKE ...` on every page load, which is
   a slow and inefficient compared to simple SELECT query by calling `createTable()`
   method from `createDBTables()` in `DBTable` class.
 * The better approach would be to introduce a database versioning system. Here 
   is a simple example: [https://gist.github.com/kurtpayne/2151282](https://gist.github.com/kurtpayne/2151282).
   You could probably implement it inside `createDBTables()` method leaving your
   existing `createTable()` method as is. 
   Now, on each page request plugin will
   still call get_option(‘your_db_version_str’) and that’s fine because we can give
   instructions to autoload this option when user activates the plugin, and set 
   the autoload flag to ‘no’ when plugin is deactivated. Here is WordPress blog 
   post explaining option function improvements with an example: [https://make.wordpress.org/core/2023/10/17/new-option-functions-in-6-4/#new-functions-to-set-option-autoload-values](https://make.wordpress.org/core/2023/10/17/new-option-functions-in-6-4/#new-functions-to-set-option-autoload-values)
   PS: if you intend to support older WordPress versions, you will have to wrap `
   wp_set_options_autoload()` or any other new functions in `function_exists()`.

Viewing 1 replies (of 1 total)

 *  [abivarman31](https://wordpress.org/support/users/abivarman31/)
 * (@abivarman31)
 * [10 months, 1 week ago](https://wordpress.org/support/topic/database-setup-dbtable-improvements/#post-18503387)
 * Hi,
 * Thank you for the useful information.
 * We’ll make sure to pass this along to our development team.
 * Thanks
   Flycart Team

Viewing 1 replies (of 1 total)

The topic ‘Database setup / DBTable improvements’ is closed to new replies.

 * ![](https://ps.w.org/woo-discount-rules/assets/icon-256x256.png?rev=1977982)
 * [Discount Rules for WooCommerce](https://wordpress.org/plugins/woo-discount-rules/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woo-discount-rules/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woo-discount-rules/)
 * [Active Topics](https://wordpress.org/support/plugin/woo-discount-rules/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woo-discount-rules/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woo-discount-rules/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [abivarman31](https://wordpress.org/support/users/abivarman31/)
 * Last activity: [10 months, 1 week ago](https://wordpress.org/support/topic/database-setup-dbtable-improvements/#post-18503387)
 * Status: resolved