简体   繁体   中英

database size for an event calendar

I'm doing a project on event calendar using php and mysql.

I have a doubt that, when we try to include events in every hour in each day, it makes the database to a huge size. because we need to see/ refer past and future events everyday.sometimes, we need some events for more days. so, what is the technique we can use to keep the size of the database in such situations?

Here is a table structure I recently used for a project:

CREATE TABLE `event` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) DEFAULT NULL,
  `description` text,
  `startdate` datetime DEFAULT NULL,
  `enddate` datetime DEFAULT NULL,
  `location` text,
  `price` double(8,2) DEFAULT NULL,
  `user_id` int(11) DEFAULT NULL,
  `created_date` datetime DEFAULT NULL,
  `seats` int(11) NOT NULL,
  `show_map` tinyint(1) DEFAULT '1',
  `latitude` varchar(65) DEFAULT NULL,
  `longitude` varchar(65) DEFAULT NULL,
  `contact` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

The event is drawn on the calendar between the start and end dates, this keeps events to one row. MySQL is capable of handling many millions of rows so I don't think you are going to run out of space.

Why do you care about storing 'something' for every hour. Store the start and end times of the events. For day long events set the start to midnight, and end to either midnight next day. Then your database grows in proportion to the number of events; NOT in proportion to the hours in a day. And You cannot possibly escape storing all the events 'somewhere'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM