View Single Post
Xaphan
SourceMod Donor
Join Date: Jun 2008
Old 04-26-2010 , 15:59   Re: Plugin Optimization Help KeyValues
Reply With Quote #9

Quote:
Originally Posted by pRED* View Post
Why not just use clientprefs? It abstracts all the database complexities (including threading), and provides caching as well.
I did try clientprefs awhile back, Foreach pref there was a new row. Again we would have around 57,000 rows.

Then I changed to use KV's, but that seems to be slowing.

sm_cookie uses 1 row per setting.

The idea was to minimize this to 1 db and 1 row per user.
Code:
CREATE TABLE `sm_preferences` (
  `auth_id` varchar(64) NOT NULL,
  `a_pref` int(11) DEFAULT '0',
  `b_pref` int(11) DEFAULT '0',
  `c_pref` int(11) DEFAULT '0',
  `d_pref` int(11) DEFAULT '0',
  `e_pref` int(11) DEFAULT '0',
  `f_pref` int(11) DEFAULT '0',
  `g_pref` int(11) DEFAULT '0',
  `h_pref` int(11) DEFAULT '0',
  `timestamp` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`auth_id`),
  UNIQUE KEY `auth_id` (`auth_id`)
)
__________________

Last edited by Xaphan; 04-26-2010 at 16:09.
Xaphan is offline