[stats-dev] Why do we care about date in the load functions?

Jim C. Nasby decibel at distributed.net
Thu Jul 29 00:18:33 EDT 2004


Looking at the query for tmsummary I'm detecting some wonkyness...

SELECT *, last_date::DATE - first_date::DATE + 1 AS days_working FROM
team_rank WHERE team_id = 1828 AND project_id = 8 AND last_date =
(SELECT MAX(last_date) FROM team_rank t2 WHERE t2.team_id =
team_rank.team_id AND t2.project_id = team_rank.project_id)

Uhm... huh?!? What's with the (expensive) max() operation?

Looking further, both team.php and participant.php's load functions
accept a date. Does anyone know why? There's only one day's worth of
data in the _rank tables. The only thing this would do is potentially
exclude teams/participants that weren't active yesterday, but that
doesn't make much sense since these functions should only be used for
single teams or participants, not for something like yesterday listings.

By the way, the reason I started looking at this is because tmsummary is
executing at least 15(!!) queries. See
http://decibel.statsdev.distributed.net/team/tmsummary.php?project_id=8&team=1828&debug=1
and http://bugs.distributed.net/show_bug.cgi?id=3729. Also, something's
wrong with the query reporting. For example,
http://decibel.statsdev.distributed.net/participant/psummary.php?project_id=8&id=39622&debug=1
is showing only 2 queries, which isn't right by a long-shot. (The
neighbor and friend queries are missing, at a minimum).
-- 
Jim C. Nasby, Database Consultant                  jim at nasby.net
Member: Triangle Fraternity, Sports Car Club of America
Give your computer some brain candy! www.distributed.net Team #1828

Windows: "Where do you want to go today?"
Linux: "Where do you want to go tomorrow?"
FreeBSD: "Are you guys coming, or what?"


More information about the stats-dev mailing list