in reply to Re^2: Amazing coincidence.
in thread Amazing coincidence.

Great diagnosis!

In fact, it was this small change that broke all node sets that were user lists and should reflect the "recent" users:

Originally, there was this query, which did not use an index on lasttime:

SELECT node_id pick_id, title pickname, node_id auth_id, title authname, experience rep FROM node, user WHERE node_id = user_id AND (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(lasttime +) < ?) ORDER BY experience $args{order}, node_id ASC LIMIT $limit

I eliminated the function on lasttime by converting the date math from math on integers/unix timestamps to math on datetime types:

SELECT node_id pick_id, title pickname, node_id auth_id, title authname, experience rep FROM node, user WHERE node_id = user_id AND lasttime > date_sub(NOW(), INTERVAL ? DAY) ORDER BY experience $args{order}, node_id ASC LIMIT $limit

which now used days where it should have used seconds:

SELECT node_id pick_id, title pickname, node_id auth_id, title authname, experience rep FROM node, user WHERE node_id = user_id AND lasttime > date_sub(NOW(), INTERVAL ? SECOND) ORDER BY experience $args{order}, node_id ASC LIMIT $limit

As my excuse, there was a similar-yet-different code path further above, where the same parameters were used for non-user nodes that were in days, instead of seconds :-)).

Replies are listed 'Best First'.
Re^4: Amazing coincidence.
by CountZero (Bishop) on Aug 28, 2011 at 19:07 UTC
    Wow, good you were not programming the Doomsday Machine!

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James