[wp-trac] [WordPress Trac] #55942: Add a "type" field to the meta and options tables
WordPress Trac
noreply at wordpress.org
Thu Apr 13 17:49:15 UTC 2023
#55942: Add a "type" field to the meta and options tables
-------------------------------------------------+-------------------------
Reporter: azaozz | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: 6.3
Component: Database | Version:
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests needs- | Focuses:
testing | performance
-------------------------------------------------+-------------------------
Comment (by rjasdfiii):
@azaozz - Does `wp_decode_value_from_db()` fetch all the meta data for a
single post_id and store it somewhere, then pick it apart,
testing/converting according to datatype?
What would the generated SQL be for "Find all posts where the meta value
'price' is between 50 and 200"? I am worried that it needs to fetch at
least all the key=price values from postmeta, then convert to float, and
only then do the comparisons. Performance-wise this is equivalent to the
current kludge involving CAST..TO FLOAT built into the SELECT's WHERE
clause. If there are a million posts, there will be on the order of a
million fetches from postmeta. And _that_ is the most costly part of the
query.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/55942#comment:37>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list