About Optimizing Querying Posts by Custom Fields
-
Hi all
first .. sorry 4 my english π
i am web developer and using wordpress as framework for any Customized CMS i want build
if i want to make a video Cms for example and want to make keys for videos instead of ID’S
each video is post has ID , and Customfield ( “vkey” => “1A2B3C” )
each post will have the customfield ( “vkey” )
so i want to make a custom page to view video by key
example.com/vid/ANYKEYHERE
will take the key and QueryPost it
my question here
if i will have more than 1,000,000 Videos [ POSTS ]i looked up at (“POSTMETA”) table structure @ wordpress database
and ofcourse they cant make this field (“UNIQUE”)
or Indexed coz this field may have alot of similar values like values of key ( _edit_last )so i think the query will look at all (“vkey”) values to find the one matching the Key comes from URL
i ask about this coz this page will be the most visited page at the cms and we will have alot of visits when we lunch it
i hope that any body can get what i talk about .. coz i know my bad english π
Thanks in Advance
-
One possible solution (but not simple) would be to have your own table containing vkey-values and post ID, indexed on vkey-value. Then use hooks to update the table whenever a post is added, updated, or deleted.
it’s right
but is there any simpler solution ?Can’t speak to the performance of that situation, but look at http://ww.wp.xz.cn/extend/plugins/custom-field-taxonomies/
Also see:
WordPress_OptimizationI would add the vkey column to the wp_posts table directly. You can make it unique and you avoid a JOIN.
Thanks for your attention .. but this plug wasnt to get what i mean
@ Scribu
Thanks for your reply .. it’s similar to vtxyzzy’s idea
i asked PHP Web Developer .. his name is Burak Guzel [phpandstuff.com]
and he helped me that i can make index(non-unique) to the field with a specific length even it’s type is TEXT
e.g. i will index the first 20 charachters from this field
–>
alter table wp_postmeta ADD INDEX (meta_value( 20 ) )Thanks 4 All
The topic ‘About Optimizing Querying Posts by Custom Fields’ is closed to new replies.