Database Query Question
-
Hi,
We use Image Copyright Manager (version 1.6) on our WooCommerce store and would like to keep it, but it’s adding significant server time to every uncached front-end page.
Query Monitor flags one of its queries as slow on every page load, including the homepage:
SELECT post_id, meta_value FROM wp_postmeta WHERE … (truncated in Query Monitor) — about 0.47 seconds per page load
It also runs two smaller postmeta queries (about 0.01 s each). That 0.47 s query alone was roughly 80% of our total database time per page. Deactivating the plugin removes it.
Environment: WordPress 7.1.3, WooCommerce, PHP 8.3 with OPcache, MariaDB 11.8, Redis object cache (connected, ~95% hit ratio), LiteSpeed server, about 1,000 products, many of them variable products with images.
Questions:
1. Why does this query run on every front-end request, including pages that don’t display copyright information?
2. Can the result be cached (object cache or transient) instead of being queried on each page load?
3. Can the query be limited to the images actually on the page, or use an indexed lookup by meta_key, rather than scanning postmeta?
4. Is there a setting to load the plugin only where credits are displayed, or a filter we can use to disable it elsewhere?
Happy to send the full query text and a Query Monitor screenshot if helpful.
Thanks,
You must be logged in to reply to this topic.