Quote:
Originally Posted by Dave
It depends; how much load do both versions cause and how long do both versions need to finish its execution?
|
Yeah, that's what I'm thinking about. I have no easy way to measure the load of each and was hoping someone could provide some insight. The query I would be using looks something like this:
Code:
SELECT LENGTH(pagetext) - LENGTH(REPLACE(pagetext, ' ', ''))+1 AS words FROM post WHERE parentid='0' AND threadid=123;
And would potentially run on every thread page load. It seems redundant to run this every time if the count of the words isn't absolutely critical. It would only change if someone edits the post, and that isn't really a big deal.
Maybe I'm answering my own question here and should just store the value. I'm sure a select statement without math is less expensive, especially if you have a really long thread.