Re: INNODB large database performance
Posted by:
Paul Smith
Date: February 22, 2013 03:38AM
Rick, Firstly thankyou for your time on this it is massively appreciated and i would buy you a pint if you worked for me :)
Please find below the schema for the other 2 tables i am joining too. I do have these indexed. I also amended my query and removed the left from the joins to group and data however i do need the left join on the site rates as they may be nulls.
/*
SQLyog Ultimate v10.51
MySQL - 5.5.29-log : Database - eddie
*********************************************************************
*/
/*!40101 SET NAMES utf8 */;
/*!40101 SET SQL_MODE=''*/;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/`eddie` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `eddie`;
/*Table structure for table `groups` */
DROP TABLE IF EXISTS `groups`;
CREATE TABLE `groups` (
`GroupID` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Channel Groups unique identifier',
`GroupName` varchar(100) NOT NULL COMMENT 'Channel Groups Name',
`GroupDescription` varchar(200) DEFAULT NULL COMMENT 'Channel Groups Description',
`Live` tinyint(1) DEFAULT '1' COMMENT 'If the group is live or not',
`UserID` int(11) DEFAULT NULL COMMENT 'Present if only visible to one user (null or zero if all)',
`CustomerID` int(11) DEFAULT NULL COMMENT 'Customer Ref',
`SiteID` int(11) DEFAULT NULL COMMENT 'Site Ref of group (null or zero for all)',
`isGlobalGroup` tinyint(1) DEFAULT '0' COMMENT 'Determines if the group is globally visible',
`CreatedByID` int(11) NOT NULL COMMENT 'Unique ref of user who created',
`DateCreated` datetime NOT NULL COMMENT 'Date group was created',
`UpdatedByID` int(11) NOT NULL COMMENT 'Unique ref of last updated',
`DateUpdated` datetime NOT NULL COMMENT 'Date last updated',
`CircuitCount` int(11) NOT NULL COMMENT 'Number of circuits in the group currently',
`ChannelTypeID` int(11) NOT NULL COMMENT 'Determines what channel types are contained in the group as only one type allowed',
`isAutoGenerated` tinyint(4) DEFAULT '0' COMMENT 'States if the group was auto generated or not',
PRIMARY KEY (`GroupID`),
KEY `FK_group_customer` (`CustomerID`),
KEY `FK_groups_user_created` (`CreatedByID`),
KEY `FK_groups_user_updated` (`UpdatedByID`),
CONSTRAINT `FK_groups_user_created` FOREIGN KEY (`CreatedByID`) REFERENCES `user` (`UserID`),
CONSTRAINT `FK_groups_user_updated` FOREIGN KEY (`UpdatedByID`) REFERENCES `user` (`UserID`)
) ENGINE=InnoDB AUTO_INCREMENT=160 DEFAULT CHARSET=latin1;
/*Table structure for table `siterates` */
DROP TABLE IF EXISTS `siterates`;
CREATE TABLE `siterates` (
`SiteRateID` int(11) NOT NULL AUTO_INCREMENT,
`SiteID` int(11) DEFAULT NULL,
`ChannelTypeID` int(11) DEFAULT NULL,
`Rate` decimal(10,5) DEFAULT NULL,
`Active` tinyint(1) DEFAULT NULL,
`CreatedByID` int(11) DEFAULT NULL,
`DateCreated` datetime DEFAULT NULL,
PRIMARY KEY (`SiteRateID`),
KEY `FK_SiteID_SiteID` (`SiteID`),
KEY `FK_ChannelTypeID_ChannelTypeID` (`ChannelTypeID`),
KEY `FK_CreatedByID_UserID` (`CreatedByID`)
) ENGINE=InnoDB AUTO_INCREMENT=3960 DEFAULT CHARSET=latin1;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
Subject
Views
Written By
Posted
3555
February 16, 2013 03:11AM
1197
February 20, 2013 05:31PM
1046
February 21, 2013 02:51AM
1279
February 21, 2013 11:12PM
Re: INNODB large database performance
1329
February 22, 2013 03:38AM
1029
February 23, 2013 12:04AM
987
February 23, 2013 03:28PM
928
February 24, 2013 02:10PM
925
February 24, 2013 03:02PM
1055
February 25, 2013 10:39PM