
06-22-2002, 03:57 PM
|
|
|
Join Date: Nov 2001
Posts: 39
Благодарил(а): 0 раз(а)
Поблагодарили:
0 раз(а) в 0 сообщениях
|
|
Quote:
Originally posted by MattR
Won't the count/update of my_threadviews cause almost as much locking problems as the current thread table?
|
Not nearly as much, IMHO. The main problem with the orginal code is that the thread table is read locked (i.e. no reads are allowed) everytime showthread.php is called (or more precisely, every time thread views are updated). Reading of the thread table is one of the most common occurences in vb: it occurs on the home page, on forum display, on showthread, on search, and probably a few others, so the locking "collisions" occur very frequently.
With this hack, the my_threadviews table is only read in showthread, so the read "collisions" are kept to a minimum.
UPDATE: with your suggestion, the table is only written to so there are almost not table-locking issues. The only time the table is read is when the views are about to be committed to the thread table.
Quote:
I would say simply keep inserting a threadID into the table, then have the job update with a count( * ), threadid group by threadid to get the threadIDs.
|
That's an excellent idea! It would remove the need for the select query on every pageview. I'll go try it out.
|