Changes between Version 1 and Version 2 of Ticket #16910
- Timestamp:
- 03/21/2011 01:08:44 AM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #16910 – Description
v1 v2 33 33 But, if you have many many countries (not a good example, I know), you waste a lot of time passing the IDs back and forth from PHP to SQL. 34 34 35 Final query: 36 37 {{{ 38 SELECT * 39 FROM wp_posts 40 WHERE post_type = 'city' 41 AND post_parent IN (1, 2, 3, ...) 42 }}} 43 35 44 It would be a lot more scalable to put the first query into the second, directly, as a subquery. 36 45 … … 60 69 ) ); 61 70 }}} 71 72 Final query: 73 74 {{{ 75 SELECT * 76 FROM wp_posts 77 WHERE post_type = 'city' 78 AND post_parent IN ( 79 SELECT ID 80 FROM wp_posts 81 WHERE post_type = 'country' 82 INNER JOIN wp_terms ... 83 ) 84 }}}