Looking at the source of class-wp-query.php
(ie, the WP_Query
code), I find this:
/*
* Ensure the ID database query is able to be cached.
*
* Random queries are expected to have unpredictable results and
* cannot be cached. Note the space before `RAND` in the string
* search, that to ensure against a collision with another
* function.
*
* If `$fields` has been modified by the `posts_fields`,
* `posts_fields_request`, `post_clauses` or `posts_clauses_request`
* filters, then caching is disabled to prevent caching collisions.
*/
$id_query_is_cacheable = ! str_contains( strtoupper( $orderby ), ' RAND(' );
…which suggests that, even with seeded randomness à la RAND(x)
, the query won’t get cached.
Related Posts:
- My WordPress site always displays a cached version of its homepage
- MySQL Error: : ‘Access denied for user ‘root’@’localhost’
- Access Denied for User ‘root’@’localhost’ (using password: YES) – No Privileges?
- MySQL Error “Operand should contain 1 column”
- How to use MySQL DECIMAL?
- Access denied for user ‘root@localhost’ (using password:NO)
- MySQL ERROR 1290 (HY000) –secure-file-priv option
- MySQL server startup error ‘The server quit without updating PID file’
- MySQL ERROR 1045 (28000): Access denied for user ‘bill’@’localhost’ (using password: YES)
- Setting up foreign keys in phpMyAdmin?
- Duplicating a MySQL table, indices, and data
- mysql Foreign key constraint is incorrectly formed error
- SELECT * FROM multiple tables. MySQL
- MySQL error code: 1175 during UPDATE in MySQL Workbench
- mysql: SOURCE error 2?
- How to avoid MySQL ‘Deadlock found when trying to get lock; try restarting transaction’
- Access denied; you need (at least one of) the SUPER privilege(s) for this operation
- MySQL foreach loop
- MySQL IF NOT NULL, then display 1, else display 0
- MySQL Server on MAMP-Windows Will Not Start
- SQL statement not working – “Operand type clash: date is incompatible with int’
- MySQL Calculate Percentage
- Repair all tables in one go
- Get the new record primary key ID from MySQL insert query?
- importing a CSV into phpmyadmin
- How can I rebuild indexes and update stats in MySQL innoDB?
- How to change collation of database, table, column?
- Failed building wheel for mysql-python
- ERROR 1115 (42000): Unknown character set: ‘utf8mb4’
- Error Code: 1290. The MySQL server is running with the –secure-file-priv option so it cannot execute this statement
- Remove Primary Key in MySQL
- How to get the max of two values in MySQL?
- select * from table where column = something or, when unavailable, column = something else
- Differences between utf8 and latin1
- There can be only one auto column
- mysql: connection refused when trying to connect to localhost using remote IP
- Error: Duplicate entry ‘0’ for key ‘PRIMARY’
- Why are simple updates to wp_postmeta’s “_edit_lock” so slow?
- What’s a good strategy for planning WordPress DB growth?
- Complex meta query with 3 keys
- How to log mysql errors from wordpress core?
- wpdb Custom Meta Data with 2 conditions
- query to create woocommerce products from images
- How can I SQL update a meta_value to remove the dollar signs that were entered with the value? (so just the value remains)
- Configure WordPress to connect to Mysql DB using SSH tunneling
- How can I make wordpress suppress mysql errors?
- How to Create a Admin User for A WordPress Site via MySQL (PHPMyAdmin)?
- Rewrite database urls
- SQL error #1062 – Duplicate entry ‘1’ for key ‘PRIMARY’ [closed]
- Changing Table Prefix for an Existing WordPresss Site
- Set meta_key and meta_value for all registered user in wordpress using sql query [closed]
- Migrating from Existing MySQL Setup to WordPress
- Connect another DB and fetch records from some tables
- How to split the a table in database?
- Error: MySQL shutdown unexpectedly [closed]
- How do I join a $wpdb query with user meta using default value if not exist?
- mySQL statment count of post in each category and sub category
- Paypal Post IPN handeling nightmare
- _prime_post_caches in wordpress
- Is there a page length limit?
- WordPress tables and aliases?
- What’s the sql for this condition?
- Create a form with custom autocomplete address field and CSV import values
- WordPress insert query is not working : Showing no Error
- How to set MYSQLI_OPT_INT_AND_FLOAT_NATIVE option
- Copy usermeta value where ID matches in the same table
- Some Post Content Does Not Show Up In DB Search
- How can I write a formal sql query to get data from a custom table
- How to insert dash (-) into database using wpdb and new_to_publish hook?
- MySQL: How to change url in posts from xxx.com to yyy.org?
- WordPress & MySQL , problem with use many array in meta_query
- How can I view my site directly from WordPress dashboard?
- Button writing to MYSQL database
- (WP List Table) How to sort by SKU and Custom Fields?
- Word Press and database from another server sync
- User set date and time from frontend doesn’t get stored into database
- get posts whether meta_key exists or not
- How to run SQL query from WordPress ‘WP Crontrol’ plugin
- How to bulk delete a certain part of all wordpress posts
- When I add metadata, metavalue length is added in to the value in some cases
- Changes not being reflected on new server
- WordPress Dutch characters encoding problem
- update_option returns false in AJAX, how to debug?
- WordPress database error Duplicate entry for key ‘slug’
- Select latest 2 articles, but only from given category
- CONCAT_WS in custom sql query
- MySQL – How to combine data from two tables into one?
- Ordering topics by most replies in X days using MYSQL statement
- Stop my loop to register data twice
- `#1215 – Cannot add foreign key constraint
- How to restore: Database intact but folders deleted
- XML RPC post produces immediate revision with odd post_date_gmt
- Woocommerce: Grab total revenue of a product over all orders
- Running WordPress from MySQL Cluster with HAPRoxy
- How to optimize ‘select found_rows()’ query? Several ‘high load average’ alerts daily
- SQL command to export post_content from wp_posts using phpMyAdmin
- SQL Database Lost
- Need SQL query to find&replace image URL
- Postgres equivalent to MySQL’s \G?
- How to check what port mysql is running on