[wp-hackers] set/modify the auto-incrementing ID of the wp_postmeta.
otto at ottodestruct.com
Mon Aug 13 21:33:40 UTC 2012
On Mon, Aug 13, 2012 at 4:12 PM, Haluk Karamete <halukkaramete at gmail.com> wrote:
> Is it OK to index the meta_value field of the wp_postmeta?
> According to phpmyadmin, meta_id, post_id and meta_key are already indexed.
> I'm sure there must be a good reason for meta_value to come not indexed.
> But what if you want indexed.
> With 32M recs in it now, I'm getting no response from the phpmyadmin
> when I query meta_value for a specific value.
You shouldn't be querying meta_value for a specific value without also
querying meta_key (and probably post_id) for a specific value as well.
And even then, the limit clause should be pretty strict so as to only
pull the first hundred or so.
WordPress's DB is architected to optimally do the kinds of things WP
does. WP is designed to pull posts and the meta associated with them
(thus the query in meta has a strict set of post_id's to check for),
or it's designed to pull posts based on meta_key=meta_value (thus the
query in meta has a meta_key to check for and then it can search on
the meta values for the comparator).
When you start doing direct queries, then the DB may not be optimized
for your specific case. But then you wouldn't expect it to be, and
that's not really what you're testing against, is it?
More information about the wp-hackers