(moving thread to wikitech-l)
Jan Hidders wrote:
From: "Brion L. VIBBER" brion@pobox.com
Jan Hidders wrote:
Dear fellow programmers,
I saw that the SQL code for the Recent Changes page is rather inefficient and causes a lot of database access, so I decided to improve this.
However,
I can only do this properly if the timestamp field in the tables is split
in
a day and a time field.
Can I ask how exactly that would help? I'm not much of a database guru, so the answer isn't obvious to me and I'm a bit curious.
It allows me to do a GROUP BY on the day. That way I can take a left outer join between the cur table and the old table and group on the combination of cur_day and cur_title. This allows me to get all the information I need for the page in one SQL statement.
Right. Hmm, can you use TO_DAYS(cur_timestamp) or some such? Or is that just going to cause problems?
If it's more efficient to use a split timestamp, I can't come up with any objection. But, it's Magnus' baby. :)
-- brion vibber (brion @ pobox.com)