Re: Implement a logging table; avoiding conflicting inserts

2007-09-11 Thread Baron Schwartz
Fan, Wellington wrote: > > Given: MySQL 4.0.12, I need to implement a pageview log with a resolution of 1 day. If you want to brute-force it, I think I would go this route: create table hits ( day date not null primary key, hitcount int unsigned not null, ); insert ignore into hits(day, hitc

RE: Implement a logging table; avoiding conflicting inserts

2007-09-11 Thread Fan, Wellington
> > Given: MySQL 4.0.12, I need to implement a pageview log with a > > resolution of 1 day. .. > > Would the "REPLACE" method work? > > David Hmmm...as I read the docs, the "LOCK IN SHARED MODE" seemed to be the real key to this. I created a test script and ran: $ ab -n100 -c100 local

Re: Implement a logging table; avoiding conflicting inserts

2007-09-11 Thread dpgirago
> Given: MySQL 4.0.12, I need to implement a pageview log with a > resolution of 1 day. > > I propose this table: > > CREATE TABLE `pageviews` ( > `id` int(11) NOT NULL auto_increment, > `date` date NOT NULL default '-00-00', > `url` char(120) NOT NULL default '', > `views` mediumint(9) NO

Implement a logging table; avoiding conflicting inserts

2007-09-10 Thread Fan, Wellington
Hello Listies, Given: MySQL 4.0.12, I need to implement a pageview log with a resolution of 1 day. I propose this table: CREATE TABLE `pageviews` ( `id` int(11) NOT NULL auto_increment, `date` date NOT NULL default '-00-00', `url` char(120) NOT NULL default '', `views` mediumint(9) N