I would like to count all messages inside every bboard on
/bboard/index.tcl. Then I would like to display, when the newest
message has been submitted to a bboard (this code is not part of my
example, because I am not that far, yet)
Which count is quicker?
"select bt.moderation_policy, bt.topic, bt.topic_id,
bt.presentation_type, count(b.msg_id) as n_messages
from bboard_topics bt, bboard b
where (bt.active_p = 't' or bt.active_p is null)
and (bt.group_id is null
or ad_group_member_p ( $user_id, bt.group_id ) = 't' )
and bt.topic_id = b.topic_id
group by bt.moderation_policy, bt.topic, bt.topic_id,
bt.presentation_type
order by $order_by"
OR
"select bt.moderation_policy, bt.topic, bt.topic_id,
bt.presentation_type, (select count(*) from bboard b where b.topic_id
= bt.topic_id) as n_messages
from bboard_topics bt
where (bt.active_p = 't' or bt.active_p is null)
and (bt.group_id is null
or ad_group_member_p ( $user_id, bt.group_id ) = 't' )
order by $order_by"
--I will util_memoize this additionally...