MySQL Forums
Forum List  »  Newbie

Re: how to solve this complex query
Posted by: aftab ali
Date: January 19, 2009 03:57AM

create table sctructure.....


DROP TABLE IF EXISTS records;
CREATE TABLE  records (
  `RECORDID` int(11) NOT NULL AUTO_INCREMENT,
  `TYPE` enum('none','buy','sell') NOT NULL DEFAULT 'none',
  `STATE` enum('none','connect','active','complete','retracted') NOT NULL DEFAULT 'none',
  `DOMAINID` int(11) NOT NULL DEFAULT '0',
  `PARTITIONID` int(11) NOT NULL DEFAULT '0',
  `GROUPID` int(11) NOT NULL DEFAULT '0',
  `ACCOUNTID` int(11) NOT NULL DEFAULT '0',
  `HOSTID` int(11) NOT NULL DEFAULT '0',
  `ORDERID` int(11) NOT NULL DEFAULT '0',
  `CALLID` int(11) NOT NULL DEFAULT '0',
  `SERVERID` int(11) NOT NULL DEFAULT '0',
  `CONNECTTIME` bigint(20) NOT NULL DEFAULT '0',
  `BEGINTIME` bigint(20) NOT NULL DEFAULT '0',
  `ENDTIME` bigint(20) NOT NULL DEFAULT '0',
  `SOURCE` char(64) NOT NULL DEFAULT '',
  `DESTINATION` char(64) NOT NULL DEFAULT '',
  `RAWSOURCE` char(64) NOT NULL DEFAULT '',
  `RAWDESTINATION` char(64) NOT NULL DEFAULT '',
  `HOST` char(64) NOT NULL DEFAULT '',
  `PREFIX` char(32) NOT NULL DEFAULT '',
  `EXCHANGE` char(64) NOT NULL DEFAULT '',
  `SVC` char(16) NOT NULL DEFAULT '',
  `GRP` char(16) NOT NULL DEFAULT '',
  `RTE` char(16) NOT NULL DEFAULT '',
  `SCOPE` enum('global','domain','partition','group') NOT NULL DEFAULT 'global',
  `FLAGS` set('soft','media','ivr','nat','redirect','disconnect') NOT NULL DEFAULT '',
  `CAPABILITIES` set('gips','g729','g729a','g729b','g729ab','g7231','gsm','ulaw','alaw','rfc2833','t38') NOT NULL DEFAULT '',
  `DURATION` int(11) NOT NULL DEFAULT '0',
  `BILLDURATION` int(11) NOT NULL DEFAULT '0',
  `RATE` decimal(7,4) NOT NULL DEFAULT '0.0000',
  `RERATE` decimal(7,4) NOT NULL DEFAULT '0.0000',
  `CURRENCY` char(16) NOT NULL DEFAULT '',
  `EXRATE` decimal(7,4) NOT NULL DEFAULT '1.0000',
  `DOMAINFEE` decimal(8,4) NOT NULL DEFAULT '0.0000',
  `PARTITIONAMOUNT` decimal(8,4) NOT NULL DEFAULT '0.0000',
  `PARTITIONMARGIN` decimal(8,4) NOT NULL DEFAULT '0.0000',
  `PARTITIONFEE` decimal(8,4) NOT NULL DEFAULT '0.0000',
  `GROUPAMOUNT` decimal(8,4) NOT NULL DEFAULT '0.0000',
  `GROUPMARGIN` decimal(8,4) NOT NULL DEFAULT '0.0000',
  `GROUPFEE` decimal(8,4) NOT NULL DEFAULT '0.0000',
  `ACCOUNTAMOUNT` decimal(8,4) NOT NULL DEFAULT '0.0000',
  `MRIP` char(32) NOT NULL DEFAULT '',
  `MRCNT` int(11) NOT NULL DEFAULT '0',
  `MRLATE` smallint(6) NOT NULL DEFAULT '0',
  `MRLOST` smallint(6) NOT NULL DEFAULT '0',
  `MRORUN` smallint(6) NOT NULL DEFAULT '0',
  `MRJIT` tinyint(4) NOT NULL DEFAULT '0',
  `MSIP` char(32) NOT NULL DEFAULT '',
  `MSCNT` int(11) NOT NULL DEFAULT '0',
  `MSORUN` smallint(6) NOT NULL DEFAULT '0',
  `MSJIT` tinyint(4) NOT NULL DEFAULT '0',
  `REFID` char(16) NOT NULL DEFAULT '',
  `QOS` tinyint(4) NOT NULL DEFAULT '100',
  `STATUS` tinyint(4) NOT NULL DEFAULT '0',
  `CODE` tinyint(4) NOT NULL DEFAULT '0',
  `MESSAGE` char(64) NOT NULL DEFAULT '',
  `ALERTTIME` bigint(20) NOT NULL DEFAULT '0',
  `SURCHARGE` decimal(7,4) NOT NULL DEFAULT '0.0000',
  `TAXRATE` decimal(7,6) NOT NULL DEFAULT '0.000000',
  PRIMARY KEY (`RECORDID`),
  KEY `CALLID` (`CALLID`),
  KEY `CONNECTTIME` (`CONNECTTIME`),
  KEY `BEGINTIME` (`BEGINTIME`),
  KEY `ENDTIME` (`ENDTIME`),
  KEY `DOMAINIDTIME` (`DOMAINID`,`CONNECTTIME`),
  KEY `PARTITIONIDTIME` (`PARTITIONID`,`CONNECTTIME`),
  KEY `GROUPIDTIME` (`GROUPID`,`CONNECTTIME`),
  KEY `ACCOUNTIDTIME` (`ACCOUNTID`,`CONNECTTIME`)
) ENGINE=MyISAM AUTO_INCREMENT=721082905 DEFAULT CHARSET=latin1 MAX_ROWS=1000000000 AVG_ROW_LENGTH=1024;



SHOW TABLE STATUS....


Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
accounts MyISAM 10 Fixed 0 0 0 1.48056E+17 1024 0 1 1/15/2009 10:10 1/15/2009 10:10 latin1_swedish_ci
calls MyISAM 10 Fixed 3643023 41 149363943 1.76094E+11 87234560 0 303058521 1/7/2008 9:59 1/14/2008 10:51 latin1_swedish_ci max_rows=1000000000 avg_row_length=1024
currencies MyISAM 10 Fixed 0 0 0 8.44425E+15 1024 0 1 1/15/2009 10:10 1/15/2009 10:10 latin1_swedish_ci
domains MyISAM 10 Fixed 1 247 247 6.95243E+16 2048 0 2 1/15/2009 10:10 1/15/2009 10:52 latin1_swedish_ci
exchangecodes MyISAM 10 Fixed 0 0 0 2.08291E+16 1024 0 1/15/2009 10:10 1/15/2009 10:10 latin1_swedish_ci
exchanges MyISAM 10 Fixed 0 0 0 2.08291E+16 1024 0 2 1/15/2009 10:10 1/15/2009 10:10 latin1_swedish_ci
fees MyISAM 10 Fixed 0 0 0 1.74514E+16 1024 0 3 1/15/2009 10:10 1/15/2009 10:10 latin1_swedish_ci
groups MyISAM 10 Fixed 375 265 99375 7.45909E+16 14336 0 805 5/31/2007 4:00 9/4/2008 19:45 5/31/2007 4:00 latin1_swedish_ci
history MyISAM 10 Dynamic 1638 50 83436 2.81475E+14 83968 0 165261 1/7/2008 9:59 1/19/2009 13:08 latin1_swedish_ci
hosts MyISAM 10 Fixed 2113 607 1745125 1.70855E+17 118784 462534 4979 1/19/2007 2:19 9/5/2008 11:03 1/19/2007 2:19 latin1_swedish_ci
logs MyISAM 10 Dynamic 0 0 0 1.09951E+12 1024 0 1 4/12/2008 22:12 4/12/2008 22:12 latin1_swedish_ci max_rows=1000000000 avg_row_length=1024
notes MyISAM 10 Dynamic 0 0 0 2.81475E+14 1024 0 1 1/15/2009 10:10 1/15/2009 10:10 latin1_swedish_ci
orders MyISAM 10 Fixed 0 0 0 1.30041E+17 1024 0 33259 1/15/2009 10:10 1/15/2009 10:10 latin1_swedish_ci
partitions MyISAM 10 Fixed 1 256 256 7.20576E+16 3072 0 3 1/15/2009 10:10 1/15/2009 11:06 latin1_swedish_ci
profiles MyISAM 10 Dynamic 1 132 132 2.81475E+14 4096 0 20 1/15/2009 10:10 1/15/2009 10:52 latin1_swedish_ci
records MyISAM 10 Fixed 9004985 780 7023888300 3.35007E+12 1356960768 0 721082905 1/7/2008 9:59 1/14/2008 10:51 latin1_swedish_ci max_rows=1000000000 avg_row_length=1024
registrations MyISAM 10 Fixed 0 0 0 8.30351E+16 1024 0 7157 1/15/2009 10:10 1/15/2009 10:10 latin1_swedish_ci
servers MyISAM 10 Fixed 0 0 0 2.50513E+16 1024 0 8 1/15/2009 10:10 1/15/2009 10:10 latin1_swedish_ci
statistics MyISAM 10 Fixed 0 0 0 7.94569E+11 1024 0 1/7/2008 9:59 1/7/2008 9:59 latin1_swedish_ci max_rows=1000000000 avg_row_length=1024
transactions MyISAM 10 Fixed 3310894 52 172166488 2.23338E+11 183202816 0 314575067 1/7/2008 9:59 1/14/2008 9:59 latin1_swedish_ci max_rows=1000000000 avg_row_length=1024
watches MyISAM 10 Fixed 1 102 102 2.87104E+16 3072 0 2 1/15/2009 10:10 1/19/2009 10:46 latin1_swedish_ci

Options: ReplyQuote


Subject
Written By
Posted
January 18, 2009 11:28PM
Re: how to solve this complex query
January 19, 2009 03:57AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.