attaching information for table - mysql

I have a data logging application for which i have created a table as shown below -
CREATE TABLE IF NOT EXISTS `waterheater`.`heatertest550001_data`
` (
`Index_Records` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`Time_Stamp` DATETIME DEFAULT NULL,
`Water_Temperature` FLOAT DEFAULT NULL,
`Body_Temperature` FLOAT DEFAULT NULL,
`Body_Shell_Top_Temperature` FLOAT DEFAULT NULL,
`Body_Shell_Bottom_Temperature` FLOAT DEFAULT NULL,
`Ambient_Temperature` FLOAT DEFAULT NULL,
`Voltage` FLOAT DEFAULT NULL,
`Current` FLOAT DEFAULT NULL,
`Wattage` FLOAT DEFAULT NULL,
`Energy` FLOAT DEFAULT NULL,
`Power_Factor` FLOAT DEFAULT NULL,
`Notice` VARCHAR(45) DEFAULT NULL,
`LVTIMESTAMP` DOUBLE DEFAULT NULL,
PRIMARY KEY (`Index_Records`),
UNIQUE INDEX `INDEX_UNIQUE` (`Index_Records`)
) ENGINE=INNODB DEFAULT CHARSET=UTF8;
And to attach information for the same table I'm creating another table as follows -
CREATE TABLE IF NOT EXISTS `waterheater`.`heatertest550001_info` (
`Index_Records` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`ReportNumber` VARCHAR(45) DEFAULT NULL,
`ProjectNumber` VARCHAR(45) DEFAULT NULL,
`TestDiscipline` VARCHAR(45) DEFAULT 'Electrical',
`Customer` VARCHAR(45) DEFAULT NULL,
`Manufacturer` VARCHAR(45) DEFAULT NULL,
`Program` VARCHAR(45) DEFAULT 'NABL',
`TestLabLocation` VARCHAR(45) DEFAULT '(b)UL Manesar',
`ItemUnderTest` VARCHAR(45) DEFAULT 'Storage Electrical Water Heater',
`Model` VARCHAR(45) DEFAULT NULL,
`NumberOfSamples` VARCHAR(45) DEFAULT NULL,
`SampleIdentification` VARCHAR(45) DEFAULT NULL,
`ManufacturerSerialNumber` VARCHAR(45) DEFAULT NULL,
`IUTCondition` VARCHAR(45) DEFAULT NULL,
`DateOfReceipt` DATETIME DEFAULT NULL,
`ApplicableStandard` VARCHAR(45) DEFAULT 'IS2082:1993 & IS 302-2-21:1992',
`DateOfTestingStartDate` DATETIME DEFAULT NULL,
`DateOfTestingStopDate` DATETIME DEFAULT NULL,
`DurationSecondsOfTesting` FLOAT DEFAULT NULL,
`DurationTestText` VARCHAR(45) DEFAULT NULL,
`LabAmbientTemperature` FLOAT DEFAULT '23',
`LabAmbientHumidity` FLOAT DEFAULT '70',
`DateOfReporting` DATETIME DEFAULT NULL,
`TestIncharge` VARCHAR(45) DEFAULT NULL,
`GeneralRemarks` VARCHAR(45) DEFAULT NULL,
`IUTRatedVoltage` FLOAT DEFAULT NULL,
`IUTRatedCurrent` FLOAT DEFAULT NULL,
`IUTRatedFrequency` FLOAT DEFAULT NULL,
`IUTRatedPower` FLOAT DEFAULT NULL,
`IUTRatedCapacity` FLOAT DEFAULT NULL,
`IUTApplianceSort` VARCHAR(45) DEFAULT 'Class 1',
`IUTRatedWaterProofDegree` VARCHAR(45) DEFAULT 'IP X4',
`IUTRatedPressure` FLOAT DEFAULT '0.80',
`IUTApplianceType` VARCHAR(45) DEFAULT NULL,
`IUTRatedStandingLoss` FLOAT DEFAULT NULL,
`CalcWaterTemperature` FLOAT DEFAULT NULL,
`CalcAmbientTemperature` FLOAT DEFAULT NULL,
`CalcVoltage` FLOAT DEFAULT NULL,
`CalcCurrent` FLOAT DEFAULT NULL,
`CalcFrequency` FLOAT DEFAULT NULL,
`CalcPower` FLOAT DEFAULT NULL,
`CalcCapacity` FLOAT DEFAULT NULL,
`CalcApplianceSort` VARCHAR(45) DEFAULT 'Class 1',
`CalcRatedWaterProofDegree` VARCHAR(45) DEFAULT 'IP X4',
`CalcPressure` FLOAT DEFAULT '0.80',
`CalcApplianceType` VARCHAR(45) DEFAULT NULL,
`CalcStandingLoss` FLOAT DEFAULT NULL,
`CalcStandingLossRate` FLOAT DEFAULT NULL,
`CalcStandingLoss24h` FLOAT DEFAULT NULL,
`EnergyConsumptionTest` FLOAT DEFAULT NULL,
`EnergyConsumption24h` FLOAT DEFAULT NULL,
`MaxRecords` FLOAT DEFAULT NULL,
PRIMARY KEY (`Index_Records`),
UNIQUE KEY `Index_Records_UNIQUE` (`Index_Records`)
) ENGINE=INNODB DEFAULT CHARSET=UTF8;
I'm sure there must be a better way to do this. Can somebody help! and thanks.

Related

Speed up MySQL query for large database

I have a table in my database that contain around 10 millions rows.
The problem occur when I execute this query : It takes a very long time to execute (12.418s) and I wonder how can I speed this query up.
SELECT *
FROM cadastre_test
WHERE latitude >= 45.1269166 AND latitude <= 45.127816 AND longitude >= -0.6631578 AND longitude <= -0.6618832
LIMIT 100 ;
I tried the BETWEEN instead of <= and >= but it was slower of 4 seconds.
Here is the CREATE TABLE query :
CREATE TABLE `cadastre_test` (
`id_mutation` varchar(255) NOT NULL,
`date_mutation` date DEFAULT NULL,
`numero_disposition` varchar(8) DEFAULT NULL,
`nature_mutation` varchar(255) DEFAULT NULL,
`valeur_fonciere` float DEFAULT NULL,
`adresse_numero` smallint(6) DEFAULT NULL,
`adresse_suffixe` varchar(128) DEFAULT NULL,
`adresse_nom_voie` varchar(128) DEFAULT NULL,
`adresse_code_voie` varchar(8) DEFAULT NULL,
`code_postal` varchar(10) DEFAULT NULL,
`code_commune` varchar(10) DEFAULT NULL,
`nom_commune` varchar(255) DEFAULT NULL,
`code_departement` varchar(10) DEFAULT NULL,
`ancien_code_commune` varchar(10) DEFAULT NULL,
`ancien_nom_commune` varchar(255) DEFAULT NULL,
`id_parcelle` varchar(20) DEFAULT NULL,
`ancien_id_parcelle` varchar(20) DEFAULT NULL,
`numero_volume` varchar(15) DEFAULT NULL,
`lot1_numero` varchar(6) DEFAULT NULL,
`lot1_surface_carrez` float DEFAULT NULL,
`lot2_numero` varchar(6) DEFAULT NULL,
`lot2_surface_carrez` float DEFAULT NULL,
`lot3_numero` varchar(6) DEFAULT NULL,
`lot3_surface_carrez` float DEFAULT NULL,
`lot4_numero` varchar(6) DEFAULT NULL,
`lot4_surface_carrez` float DEFAULT NULL,
`lot5_numero` varchar(6) DEFAULT NULL,
`lot5_surface_carrez` float DEFAULT NULL,
`nombre_lots` smallint(6) DEFAULT NULL,
`code_type_local` smallint(6) DEFAULT NULL,
`type_local` varchar(255) DEFAULT NULL,
`surface_reelle_bati` float DEFAULT NULL,
`nombre_pieces_principales` smallint(6) DEFAULT NULL,
`code_nature_culture` varchar(10) DEFAULT NULL,
`nature_culture` varchar(255) DEFAULT NULL,
`code_nature_culture_speciale` varchar(255) DEFAULT NULL,
`nature_culture_speciale` varchar(255) DEFAULT NULL,
`surface_terrain` float DEFAULT NULL,
`longitude` decimal(11,7) DEFAULT NULL,
`latitude` decimal(11,7) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
add an index on your table for latitude , longitude:
create index inx_lang_long on cadastre_test (latitude , longitude) ;

Why does a query run nearly 100 times slower when only changing a WHERE clause value?

I have the following query:
SELECT count(m.p1_elo_one)
FROM belgarath.match_result as m
INNER JOIN belgarath.tournament AS tm ON tm.id_ = m.tournament_id
INNER JOIN belgarath.tour AS tr ON tr.id_ = tm.tour_id
INNER JOIN belgarath.rank AS rk ON rk.id_ = tm.rank_id
INNER JOIN belgarath.round AS rd ON rd.id_ = m.round_id
INNER JOIN belgarath.parameters_match AS pm
ON pm.tour_id = tm.tour_id
AND pm.rank_id = tm.rank_id
AND pm.round_id = m.round_id
INNER JOIN belgarath.surf ON belgarath.surf.id_ = tm.surf
INNER JOIN belgarath.player AS p ON p.id_ = m.p1_id
WHERE
belgarath.surf.surf_std_id = 1
AND pm.engineer = 1
AND m.date_time_inferred < "2003-06-01"
AND m.date_time_inferred > "2000-06-01"
AND m.p1_elo_one IS NOT NULL
AND p.name_ NOT LIKE "%/%"
The match_result table is about 1.4m records and the query runs fine in about 0.4 seconds and returns a count of circa 20k. Great.
However, when I change belgarath.surf.surf_std_id = 1 to belgarath.surf.surf_std_id = 2 then the query suddenly takes around 35 seconds to return a count of circa 20k.
This has me stumped as I'm only changing an input variable, nothing else.
Any ideas on where the issue might be?
Edit:
SHOW CREATE TABLE for match_result:
'CREATE TABLE `match_result` (
`id_` int NOT NULL AUTO_INCREMENT,
`date_time_op_scheduled` datetime DEFAULT NULL,
`date_time_op_actual` datetime DEFAULT NULL,
`date_time_oc_actual` datetime DEFAULT NULL,
`date_time_inferred` datetime DEFAULT NULL,
`tournament_id` int DEFAULT NULL,
`round_id` tinyint DEFAULT NULL,
`p1_id` int DEFAULT NULL,
`p2_id` int DEFAULT NULL,
`result` varchar(45) DEFAULT NULL,
`uncertainty` float DEFAULT NULL,
`uncertainty_bin` int DEFAULT NULL,
`p1_win_pred` float DEFAULT NULL,
`p1_win_SD` float DEFAULT NULL,
`url` varchar(255) DEFAULT NULL,
`winning_player` int DEFAULT NULL,
`completed_sets` int DEFAULT NULL,
`result_type_id` int DEFAULT NULL,
`p1_pinnacle_closing_odds` float DEFAULT NULL,
`p2_pinnacle_closing_odds` float DEFAULT NULL,
`post_match_data_retrieved` int DEFAULT NULL,
`p1_elo_all` float DEFAULT NULL,
`p1_elo_exc_ret_all` float DEFAULT NULL,
`p1_h2h_win_one_time` float DEFAULT NULL,
`p1_h2h_win_one_none` int DEFAULT NULL,
`p1_h2h_win_all_time_surf` float DEFAULT NULL,
`p1_h2h_win_all_surf` float DEFAULT NULL,
`p1_h2h_win_all_time` float DEFAULT NULL,
`p1_h2h_win_all_none` int DEFAULT NULL,
`p1_h2h_one_time` float DEFAULT NULL,
`p1_h2h_one_none` int DEFAULT NULL,
`p1_h2h_all_time_surf` float DEFAULT NULL,
`p1_h2h_all_surf` float DEFAULT NULL,
`p1_h2h_all_time` float DEFAULT NULL,
`p1_h2h_all_none` int DEFAULT NULL,
`p1_win_one_time` float DEFAULT NULL,
`p1_win_one_none` int DEFAULT NULL,
`p1_win_all_time_surf` float DEFAULT NULL,
`p1_win_all_surf` float DEFAULT NULL,
`p1_win_all_time` float DEFAULT NULL,
`p1_win_all_none` int DEFAULT NULL,
`p1_match_one_time` float DEFAULT NULL,
`p1_match_one_none` int DEFAULT NULL,
`p1_match_all_time_surf` float DEFAULT NULL,
`p1_match_all_surf` float DEFAULT NULL,
`p1_match_all_time` float DEFAULT NULL,
`p1_match_all_none` int DEFAULT NULL,
`p1_elo_one` float DEFAULT NULL,
`p1_elo_exc_ret_one` float DEFAULT NULL,
`p1_jet_lag` float DEFAULT NULL,
`p1_fatigue_short_term` int DEFAULT NULL,
`p1_fatigue_long_term` int DEFAULT NULL,
`p1_retired_last_match` tinyint DEFAULT NULL,
`p2_elo_all` float DEFAULT NULL,
`p2_elo_exc_ret_all` float DEFAULT NULL,
`p2_h2h_win_one_time` float DEFAULT NULL,
`p2_h2h_win_one_none` int DEFAULT NULL,
`p2_h2h_win_all_time_surf` float DEFAULT NULL,
`p2_h2h_win_all_surf` float DEFAULT NULL,
`p2_h2h_win_all_time` float DEFAULT NULL,
`p2_h2h_win_all_none` int DEFAULT NULL,
`p2_h2h_one_time` float DEFAULT NULL,
`p2_h2h_one_none` int DEFAULT NULL,
`p2_h2h_all_time_surf` float DEFAULT NULL,
`p2_h2h_all_surf` float DEFAULT NULL,
`p2_h2h_all_time` float DEFAULT NULL,
`p2_h2h_all_none` int DEFAULT NULL,
`p2_win_one_time` float DEFAULT NULL,
`p2_win_one_none` int DEFAULT NULL,
`p2_win_all_time_surf` float DEFAULT NULL,
`p2_win_all_surf` float DEFAULT NULL,
`p2_win_all_time` float DEFAULT NULL,
`p2_win_all_none` int DEFAULT NULL,
`p2_match_one_time` float DEFAULT NULL,
`p2_match_one_none` int DEFAULT NULL,
`p2_match_all_time_surf` float DEFAULT NULL,
`p2_match_all_surf` float DEFAULT NULL,
`p2_match_all_time` float DEFAULT NULL,
`p2_match_all_none` int DEFAULT NULL,
`p2_elo_one` float DEFAULT NULL,
`p2_elo_exc_ret_one` float DEFAULT NULL,
`p2_jet_lag` float DEFAULT NULL,
`p2_fatigue_short_term` int DEFAULT NULL,
`p2_fatigue_long_term` int DEFAULT NULL,
`p2_retired_last_match` tinyint DEFAULT NULL,
`engineered` tinyint DEFAULT NULL,
`updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id_`),
KEY `ix_belgarath_match__completed_sets` (`completed_sets`),
KEY `ix_belgarath_match__post_match_data_retrieved` (`post_match_data_retrieved`),
KEY `ix_belgarath_match__date_time_oc_actual` (`date_time_oc_actual`),
KEY `ix_belgarath_match__tournament_id` (`tournament_id`),
KEY `ix_belgarath_match__round_id` (`round_id`),
KEY `ix_belgarath_match__player_id_2` (`p2_id`),
KEY `ix_belgarath_match__winning_player` (`winning_player`),
KEY `ix_belgarath_match__result_type_id` (`result_type_id`),
KEY `ix_belgarath_match__uncertainty_bin` (`uncertainty_bin`),
KEY `ix_belgarath_match__date_time_inferred` (`date_time_inferred`),
KEY `ix_belgarath_match__date_time_op_actual` (`date_time_op_actual`),
KEY `ix_belgarath_match__player_id_1` (`p1_id`),
KEY `ix_belgarath_match__date_time_op_scheduled` (`date_time_op_scheduled`) /*!80000 INVISIBLE */,
KEY `ix_belgarath_match__engineered` (`engineered`),
CONSTRAINT `match_result__player_1` FOREIGN KEY (`p1_id`) REFERENCES `player` (`id_`),
CONSTRAINT `match_result__player_2` FOREIGN KEY (`p2_id`) REFERENCES `player` (`id_`),
CONSTRAINT `match_result__round` FOREIGN KEY (`round_id`) REFERENCES `round` (`id_`),
CONSTRAINT `match_result__tournament` FOREIGN KEY (`tournament_id`) REFERENCES `tournament` (`id_`)
) ENGINE=InnoDB AUTO_INCREMENT=1408022 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci'
EXPLAIN for the query:

MySQL performance, should this take hours?

I am running the following query in MySQL Workbench:
UPDATE directorylistings INNER JOIN postcodelatlng ON PostalCode = postcode
set directoryListings.Latitude = postcodelatlng.latitude, directoryListings.Longitude = postcodelatlng.longitude
WHERE PostalCode = postcode;
Table directorylistings has 9000 records, postcodelatlng has nearly 2 million records.
directorylistings has a postcode (zip code) field and I'm looking this up in postcodelatlng to retrieve and update the latitude and longitude fields in directorylistings.
Ater timeout issues I found I should change DBMS connection read time out, I set this to 36000 (10 hours). The query has been running of 5 hours so far.
My question is, is this time reasonable? Should I be indexing something? Could the query be optimised?
I did make a 2 record version of the postcodelatlng and ran the query, 16 rows were correctly changed in 0.04 seconds, so I know the query is at least workable.
I have looked at a number of Q/A's on indexing and optimising, but it's taken me over a day to get this far and if it fails again I would like to know what approach to follow. I can't keep trying things and waiting hours for the failure! I bet this query should really take seconds. I'm using a MacBook Pro with a 2.5GHz i7, 16 GB RAM and ssd drive.
Many Thanks.
cpu is at 99%. I aborted after 12 hours! to run the show create tables:
CREATE TABLE `postcodelatlng` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`postcode` varchar(8) NOT NULL,
`latitude` decimal(18,15) NOT NULL,
`longitude` decimal(18,15) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1734490 DEFAULT CHARSET=latin1
CREATE TABLE `directorylistings` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`Active` tinyint(1) DEFAULT NULL,
`Tag11` tinyint(1) DEFAULT NULL,
`Minyan` tinyint(1) DEFAULT NULL,
`Latitude` double DEFAULT NULL,
`Longitude` double DEFAULT NULL,
`AffiliatedDate` double DEFAULT NULL,
`RegisteredDate` datetime DEFAULT NULL,
`AccountID` varchar(10) DEFAULT NULL,
`ShowListing` tinyint(1) DEFAULT NULL,
`Bloguser` tinyint(1) DEFAULT NULL,
`Trusted` tinyint(1) DEFAULT NULL,
`ClassifiedUser` tinyint(1) DEFAULT NULL,
`HostingID` int(11) DEFAULT NULL,
`EndDate` double DEFAULT NULL,
`EndPromoDate` datetime DEFAULT NULL,
`BaseID` int(11) DEFAULT NULL,
`Banner` varchar(50) DEFAULT NULL,
`PrivateListing` tinyint(1) DEFAULT NULL,
`Reserved1` tinyint(1) DEFAULT NULL,
`Reserved2` tinyint(1) DEFAULT NULL,
`Reserved3` tinyint(1) DEFAULT NULL,
`Reserved4` tinyint(1) DEFAULT NULL,
`Reserved5` tinyint(1) DEFAULT NULL,
`CommunityOrg` tinyint(1) DEFAULT NULL,
`Tag1` tinyint(1) DEFAULT NULL,
`Tag2` tinyint(1) DEFAULT NULL,
`Tag3` tinyint(1) DEFAULT NULL,
`Tag4` tinyint(1) DEFAULT NULL,
`Tag5` tinyint(1) DEFAULT NULL,
`Tag6` tinyint(1) DEFAULT NULL,
`Tag7` tinyint(1) DEFAULT NULL,
`Tag8` tinyint(1) DEFAULT NULL,
`Tag9` tinyint(1) DEFAULT NULL,
`Tag10` tinyint(1) DEFAULT NULL,
`Tag12` tinyint(1) DEFAULT NULL,
`Tag13` tinyint(1) DEFAULT NULL,
`Tag14` tinyint(1) DEFAULT NULL,
`ShomerShabbos` tinyint(1) DEFAULT NULL,
`CategoryID1` int(11) DEFAULT NULL,
`CategoryID2` int(11) DEFAULT NULL,
`CategoryID3` int(11) DEFAULT NULL,
`CategoryID4` int(11) DEFAULT NULL,
`CategoryID5` int(11) DEFAULT NULL,
`CategoryID6` int(11) DEFAULT NULL,
`HiddenCategory` int(11) DEFAULT NULL,
`Company` varchar(100) DEFAULT NULL,
`Slogan` varchar(250) DEFAULT NULL,
`Description` varchar(2000) DEFAULT NULL,
`CharShown` int(11) DEFAULT NULL,
`Address` varchar(100) DEFAULT NULL,
`Unit` varchar(50) DEFAULT NULL,
`Address2` varchar(150) DEFAULT NULL,
`Streetno` varchar(50) DEFAULT NULL,
`Building` varchar(50) DEFAULT NULL,
`Parade` varchar(50) DEFAULT NULL,
`Locality` varchar(50) DEFAULT NULL,
`City` varchar(50) DEFAULT NULL,
`Province` varchar(50) DEFAULT NULL,
`PostalCode` varchar(10) DEFAULT NULL,
`Country` varchar(25) DEFAULT NULL,
`PhoneNumber` varchar(70) DEFAULT NULL,
`Ext` varchar(25) DEFAULT NULL,
`PhoneNumber2` varchar(70) DEFAULT NULL,
`FaxNumber` varchar(30) DEFAULT NULL,
`CellNumber` varchar(30) DEFAULT NULL,
`WebUrl` varchar(100) DEFAULT NULL,
`Email` varchar(75) DEFAULT NULL,
`Password` varchar(30) DEFAULT NULL,
`ContactName` varchar(100) DEFAULT NULL,
`Keywords` varchar(355) DEFAULT NULL,
`Dcount` int(11) DEFAULT NULL,
`LocationID` int(11) DEFAULT NULL,
`Comments` varchar(1500) DEFAULT NULL,
`ApplicantName` varchar(200) DEFAULT NULL,
`ApplicantPhone` varchar(200) DEFAULT NULL,
`ApplicantEmail` varchar(200) DEFAULT NULL,
`Photo1` varchar(250) DEFAULT NULL,
`pRating` int(11) DEFAULT NULL,
`sRating` int(11) DEFAULT NULL,
`vRating` int(11) DEFAULT NULL,
`Private` tinyint(1) NOT NULL DEFAULT '0',
`VeryPrivate` tinyint(1) NOT NULL DEFAULT '0',
`SemiSecure` tinyint(1) NOT NULL DEFAULT '0',
`Secure` tinyint(1) NOT NULL DEFAULT '0',
`Secret` tinyint(1) NOT NULL DEFAULT '0',
`TrustHigh` tinyint(1) NOT NULL DEFAULT '0',
`FL` tinyint(1) NOT NULL DEFAULT '1',
`GJ` tinyint(1) NOT NULL DEFAULT '1',
`Recommended` tinyint(1) NOT NULL DEFAULT '0',
`NonGeo` tinyint(1) NOT NULL DEFAULT '0',
`Edited` datetime DEFAULT NULL,
`Editor` varchar(40) DEFAULT NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `ID_UNIQUE` (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=27167 DEFAULT CHARSET=utf8

Search invisible characters in mysql

There are some columns in my mysql table which contain values such as "Sbeed Pharmaceuticals åÊ" . Two questions:
How do I prevent getting these characters from getting into the table in the first place ?
How do I find rows containing these characters ?
Here is the table:
CREATE TABLE `drugs` (
`drug-id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`th-class` varchar(512) DEFAULT NULL,
`division` varchar(512) DEFAULT NULL,
`name` varchar(512) DEFAULT NULL,
`brand-name` varchar(64) DEFAULT NULL,
`pack` varchar(512) DEFAULT NULL,
`rx-type` varchar(16) DEFAULT NULL,
`pack-form` varchar(128) DEFAULT NULL,
`available-in` varchar(512) DEFAULT NULL,
`mrp` double DEFAULT '-1',
`mrp-per-unit` double DEFAULT NULL,
`manufacturer` varchar(512) DEFAULT NULL,
`schemes` text,
`drug-status` varchar(64) DEFAULT 'new',
`created-by` varchar(512) DEFAULT NULL,
`created-at` datetime DEFAULT CURRENT_TIMESTAMP,
`approved-at` datetime DEFAULT NULL,
`approved-by` varchar(512) DEFAULT NULL,
`dosage` varchar(64) DEFAULT NULL,
`manufacturer-id` int(10) DEFAULT NULL,
PRIMARY KEY (`drug-id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

MySQL remove uuid function from table

I have a table that was inherited from a different system and one of the fields has the UUID function enabled so no matter what ID I generate and try to insert, the table creates a completely different one automatically.
I would like to use a PHP function to create the ID instead but I can't workout how to remove the UUID function from the field.
I am not sure what information will be needed to help you so please feel free to ask.
The field in question is
id, char(36)
Table definaition is..
CREATE TABLE `users` (
`id` char(36) NOT NULL,
`user_name` varchar(60) default NULL,
`user_hash` varchar(32) default NULL,
`diary_weekly_view` varchar(500) NOT NULL,
`week_start` date NOT NULL,
`diary_monthly_view` varchar(300) NOT NULL,
`diary_view` int(1) NOT NULL default '1',
`account_search` varchar(1000) NOT NULL,
`cases_search` varchar(500) NOT NULL,
`serials_search` varchar(500) NOT NULL,
`type` varchar(8) NOT NULL,
`email` varchar(255) NOT NULL,
`notes` varchar(3000) NOT NULL,
`authenticate_id` varchar(100) default NULL,
`sugar_login` tinyint(1) default '1',
`first_name` varchar(30) default NULL,
`last_name` varchar(30) default NULL,
`reports_to_id` char(36) default NULL,
`is_admin` tinyint(1) default '0',
`receive_notifications` tinyint(1) default '1',
`date_entered` datetime NOT NULL,
`date_modified` datetime NOT NULL,
`modified_user_id` char(36) default NULL,
`created_by` char(36) default NULL,
`phone_office` varchar(50) default NULL,
`phone_mobile` varchar(50) default NULL,
`status` varchar(25) default NULL,
`address_street` varchar(150) default NULL,
`address_city` varchar(100) default NULL,
`address_state` varchar(100) default NULL,
`address_country` varchar(25) default NULL,
`address_postalcode` varchar(9) default NULL,
`user_preferences` text,
`deleted` tinyint(1) NOT NULL default '0',
`portal_only` tinyint(1) default '0',
`employee_status` varchar(25) default NULL,
`is_group` tinyint(1) default '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf
OK, sussed it, I removed the index and then recreated the index with INDEX