WordPress uses this feature of MySQL to get a total count of posts when you are only retrieving limited amount (100 posts total, but only 10 posts per page).
From quick look at source there is no_found_rows
query argument that can disable it. That will wreck pagination and should only be used with specific queries that don’t need counting (for example get_posts()
uses it by default).
You probably need to look into performance of your database overall (if you are running something crazy large) or if there are issues with configuration (if you are running something small enough to not possibly cause issues with resources).
Related Posts:
- Pagination with custom SQL query
- duplicated posts when using pagination
- Custom query (author is post_author or meta co_author) with Pagenavi pagination
- How can i retrieve default post per page value? from settings->reading. And total number of posts?
- Multiple WP_Query loops with Pagination
- Different ‘posts_per_page’ setting for first, and rest of the paginated pages?
- how does $wpdb differ to WP_Query?
- Custom WP_Query order by post_meta and (author) user_meta
- Pagination with 5 posts per page
- Pagination custom query
- Pagination/infinite scroll with WP_Query and multiple loops
- How can I connect to another WP database and use WP_Query?
- WP_query and pagination?
- pagenavi with merged wp_query [duplicate]
- Add and in the header while looping over custom query in page template
- Pagination not working on static page
- ‘paged’ in wp_query doesn’t work
- Display different number of posts from one category on the different pages
- Pagination not working Search posts
- Get number of comments after modifying comment query
- How to change a custom query into a standard loop?
- Pagination not working for category posts
- WP Query with offset breaks wp_pagenavi or any pagination
- Search – Ajax – Alter Query Parameters with Pagination
- Show single post then all posts (with pagination)
- How to count data records in wordpress which have same meta_value in wp_postmeta table?
- WordPress pagination link always leads to home page
- $wpdb->insert inserting two rows in database
- Detect featured image among the attached images
- Select from wp_post and multiple meta_value from wp_postmeta
- Order by custom table and multiplication
- WP_Query ajax loader detect end of posts
- $wpdb select date range of posts
- WPDB query – decrypting DB data
- Storing query variable and then using wp_reset_query
- Pagination of a WP_Query Loop in a child-page page template
- How to delete taxonomy term when a wordpress user is removed?
- Five posts from a category in footer
- WordPress Pagination changes my template
- wp_query ‘s’, search filter with pagination is not working
- Custom Pagination Layout for Elementor widget
- WordPress pagination not working on template search.php
- Cutom wp_query for geolocation search, pagination not working
- Pagination outside of loop
- Custom Pagination in Shortcode with WP_Query
- Avoid repeated post on page 2 when excluding one on page 1
- WP Query to have sticky posts first, with pagination and having a joint ‘posts per page’ arg with main loop
- Pagination for blog posts reloading same page [closed]
- How to access custom WordPress database tables
- How to pass orderby params to $wpdb->prepare()?
- WordPress query posts with multiple post_meta data
- Include latest author posts with pagination in single template?
- get_post() is not returning correct value
- Yoast primary category query modification
- Page navigation doesn’t seem to work when I add offset?
- Pagination in html table is not working
- I am officially missing something about transient posts
- WP_query paged pagination with excluded category still counts it
- Disable (or limit) queries when certain content (or data) is not needed (or showed)
- WP_Query Pagination
- WP_Query, Paginate by Custom Field
- Why is my pagination /page/2 taking me to index.php?
- Passing a SQL query to the WP Query
- How can I have sticky posts while ALSO showing posts from a specific category using one WP_Query?
- WP_query pagination on frontpage
- Pagination unique to a widget
- Why pagination is not working with tax_query param?
- paginate_links method doesn’t show second page of my custom wp_query
- Wp_Query Post per page not working?
- 404 page on custom search pagination
- Paging works correctly on local version, but not live?
- Pagination not working in custom loop WP_Query
- Showing the correct number of posts_per_page when avoiding the use of post__not_in
- Paginate nested query of child posts
- How to set up pagination for a custom loop on a global template (author.php, tag.php, archive.php?)
- Include post_status check within $wpdb query
- wpdb get_results() returns only 2 rows
- previous_posts_link not working in WordPress pagination
- Optimising amount of calls to custom fields
- Pagination not working with WP_QUERY
- WP_Query with meta_value_num and meta_query not paged correctly
- pre_get_posts or $where, which one to use?
- Search Query that Includes Custom Table
- Pagination with WP_Query not working
- wp_query pagination links producing 404
- Why won’t my paged wp_query work? [duplicate]
- WP_Query breaks pagination
- Pagination doesn’t work for home page custom post type query
- Loop issues when creating custom query for media uploader
- Query multiple taxonomies with pagination
- paginate_links() with Custom Taxonomy
- Pagination problem with multiple loops on the same page
- wpdb LIKE request shows all database data
- How much does $wpdb->prepare(), then $wpdb->query() VS straight $wpdb->query(), can slow down the load time of whole page
- how to use transient method?
- error with $query->have_posts()
- Show number of posts AND number on current page (cannot make it work)
- get_post_meta bringing back results, but $wpdb->postmeta doesn’t
- Limit paginated result set to a maximum number of posts
- Is there another way to retrieve a post_id from post_meta other than a SQL query?