It is relatively rare for WP to have query performance issues on a small to moderately sized site:
- The queries it typically runs are reasonable (not perfect, but reasonable).
- A lot of things queried are aggressively cached within page load, and persistently with object cache available.
While you certainly can throw enough code at it for queries to boggle down, 20s seems extreme. Unless we are talking hundreds of thousands of items.
If the change is sudden as well, I would strongly suspect the issue is on DB server side and tables might need optimize/repair.
Related Posts:
- Job and Employee Performance Tracking with Product Safety
- get_results using wpdb
- Count & Display Database Queries
- WordPress database scalability from the code perspective
- Performance tips for a large user base [closed]
- WP_Options ID high
- Export wordpress table to excel
- WordPress for a very large website
- WordPress database becoming huge. How to analyze and optimize it? fear of running out of memory
- Improve or optimize a very slow query
- WooCommerce with thousands of products – site is very slow – optimize db queries? [closed]
- Efficiency on displaying random authors based on large database
- How best to inject ads between posts in the loop?
- How to solve slow WordPress site caused by attachment_metadata
- Change SQL get_results to search for posts with custom term in custom taxonomy
- Change all http to https in mysql databse?
- WooCommerce – Query for ordered products
- PHP variable in WordPress database query
- Relationship between performance and database size
- WP_Query Performance Issues with meta_query
- Delete duplicate rows from wordpress database where a column is duplicate in phpmyadmin
- Database slowdown after update to 3.4.1
- Query WordPress database by registered date and role
- How to prevent WordPress from retrieving data for the last 10 posts in the database?
- wp_redirection_404 table has grown to 7GB
- Query from a different database than the default
- How to query the WordPress database to get posts of a certain custom post type, taxonomy and field?
- Select Multiple meta_value from WP DB; Single Query
- Which is more efficient? Using usermeta, or creating a new MySQL table?
- One post carries 30 postmeta values, is this too much?
- CRUD operations using WordPress database API
- Hook directly into query execution
- Multiple wp_options tables to share content across installs
- Advanced SELECT query with condtional statements
- Select two sums with single get_var statement
- Improve performance by removing unnecessary database queries
- Replace/Mute/Stop Search Query
- Slow queries constantly getting stuck on WordPress database of ~100,000 posts
- cache specific data?
- fastest replacement DB
- How to prevent/delay MySQL connections when an object cache is used?
- Does auto_load to ‘no’ in wp_options improve performance
- How Can I Put Meta_Compare in the Database-Query?
- How to paginate information obtained from a query to a custom table?
- Historic WordPress database connection
- Check if an option exists and get its value in one hit
- How to combine multiple wp_insert_post into one in order to gain better performance
- Query multiple tables at once?
- $wpdb->query can’t insert data
- Custom WordPress Table wpdb
- Best practice to limit results in get_row()?
- How to display content from external db with relevant urls
- Connecting to a different database
- SQL query to set posts in bulk based on the post content
- Query Column of Specific ID from Database Table
- Optimizing function that automatically creates internal links based on post title string
- Custom search query by category id
- How to display data from db in select list [closed]
- How can I query the db to access current post information?
- Compare User meta_value with Product meta_value
- Is there anyway to split posts to different databases?
- How to insert a value to decimal type field using wpdb->prepare?
- Join Query on WP_USERMETA Table
- Insert NULL value using prepare()
- What structure and database storage method should I use for temporary storage that may be written concurrently?
- Get all top categories, then only 3 posts for each
- Best way to store 1 billion+ posts?
- Optimize WP site for millions of posts
- WordPress Database Query works in phpMyAdmin but not in the code
- wpdb query to insert images in to post/page gallery
- Set SQL_BIG_SELECTS and MAX_JOIN_SIZE on a WP_Query
- Counting user’s comments – efficient way?
- How to optimise this database query?
- How can we speed up wp_get_nav_menu_items()?
- Extracted CSV as Array for Custom Query Loop
- Should I Use only wpdb Class to Write Custom Queries?
- Generating an HTML table from an array based on dynamic key values
- Mysql Queries per Visit – Crazy High
- Pulling values from a sepcific row in table
- Using class id from array for query
- database search feature
- WordPress Admin Page Slow. Customer Post Type is the slowest
- SQL Query to get post_id from wp_posts and and meta_key(s) from wp_postmeta
- SQL query to rewrite all media URLs to end with .webp
- How do I find users by password?
- Are There Any Plans for WordPress to Support Databases Other Than MySQL?
- how can get database name in wordpress?
- WordPress and automated MySQL backups to a different host
- Get all images from this database table
- Delete transients in website
- Bulk-create posts from SQL database
- Logins from WP users table use on another page
- I’m not able to get access to $wpdb [duplicate]
- WordPress database connection [closed]
- Link image with data from the wpdb
- Is there an actual way to synchronize ‘production’ and ‘develop’ WordPress databases?
- Lost database connection
- Can someoene please help with customization of a post?
- Error establishing database connection error during first WordPress run
- Uploading to WordPress Database