User actions such as social networks facebook, myspace, all big

I am working on a site such as a social network in PHP, I did it once before, and the site outgrew my coding ability to keep up, it was a couple of years ago, and now I want to start this project again.

Basically, on my network there is a friend_friend mysql table that tracks who is a friend, for each confirmed friend there are two entries in the database: this table:

    CREATE TABLE IF NOT EXISTS `friend_friend` (
  `autoid` int(11) NOT NULL AUTO_INCREMENT,
  `userid` int(10) DEFAULT NULL,
  `friendid` int(10) DEFAULT NULL,
  `status` enum('1','0','3') NOT NULL DEFAULT '0',
  `submit_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `alert_message` enum('yes','no') NOT NULL DEFAULT 'yes',
  PRIMARY KEY (`autoid`),
  KEY `userid` (`userid`),
  KEY `friendid` (`friendid`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1657259 ;

Then I have a user table with all the user information called friend_reg_user

Then the table for newsletters that users publish, the object should show only newsletters from users with whom you are friends. Here is the bulletin table

CREATE TABLE IF NOT EXISTS `friend_bulletin` (

  `auto_id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(10) NOT NULL DEFAULT '0',
  `bulletin` text NOT NULL,
  `subject` varchar(255) NOT NULL DEFAULT '',
  `color` varchar(6) NOT NULL DEFAULT '000000',
  `submit_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `status` enum('Active','In Active') NOT NULL DEFAULT 'Active',
  `spam` enum('0','1') NOT NULL DEFAULT '1',
  PRIMARY KEY (`auto_id`),
  KEY `user_id` (`user_id`),
  KEY `submit_date` (`submit_date`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=455144 ;

, , friend_friend, 1,2,3,4,5,6. , .

- JOINS .

, , , , , ? ? , , , , ,

+3
2

, , . , ( ) .

, .

. - cron, MapReduce .. , - , .

Memcache - , , . , Memcache . , memcached servier , .

, MongoDB, CouchDB, Project Voldemort neo4j .

Id PHP Elgg at http://www.elgg.org/

+2

Facebook memcached SQL -. , , .

0

Source: https://habr.com/ru/post/1713264/


All Articles