[wp-hackers] SELECT DISTINCT .... ORDER BY not working....
Computer Guru
computerguru at neosmart.net
Tue Nov 20 07:09:21 GMT 2007
On 11/20/07, Stephane Daury <wordpress at tekartist.org> wrote:
>
>
> Very sorry about the staggered posting, but I just flashed on
> something I think you might wanna consider.
>
> Since you mentioned you're under MySQL 5.x, you could consider setting
> up and indexing (if possible) a pre-sorted view instead of using a
> subselect.
>
> http://dev.mysql.com/doc/refman/5.0/en/views.html
>
> CREATE VIEW whatever_view_name AS
> SELECT comment_post_id
> FROM wp_comments
> WHERE comment_approved = '1'
> ORDER BY comment_date DESC;
>
> Again, it's just in the spirit of scalability, and I guess it's not
> any more subject to *breakage* at upgrade time than writing your own
> queries.
>
> 'k, I'll shut up if I have another idea now. ;-)
>
> S.
No, don't do that!
I was actually thinking about that; but it's kinda like wtf is the point of
making this one custom query all super-fast when the rest of WP isn't? I've
seen a lot of code there that could benefit from subqueries, views, and
other new MySQL features - but when we're supporting MySQL 3 none of that's
going to happen.
--
Computer Guru
Director,
NeoSmart Technologies
http://neosmart.net/blog/
More information about the wp-hackers
mailing list