mysql - Index changes with varchar values -
My query shows different varchar values for different types of my table structure.
table create `equipmentdata` (` EqpmDataDBId` int (11) NOT NULL AUTO_INCREMENT, `SerialNumber` double default '0',` ReadValue` boat default '0', `ReadTime` varchar ( 25) default zero, `DataType` varchar (100) default zero,` EquipmentDBId` int (11) default '0', `EquipmentCustomId` varchar (50) default zero,` LocationCustomId` varchar (50) default zero, `ChannelCustomId` varchar (50) default zero, `ChannelName` varchar (100) default zero,` IsUploaded` tinyint (1) default "0", pRIMARY KEY ( `EqpmDataDBId`), unique key` SerialNumber` ( `SerialNumber`,` EquipmentCustomId` , `LocationCustomId`,` ChannelCusto MId`), KEY `ReadTime` (` LocationCustomId`, `EquipmentCustomId`,` ChannelCustomId`, `ReadTime`), Kunji` SECONDARY` (` EqpmDataDBId`, `Sthankstmaidi`,` Upakrnkstmaidi` "Canlsistmaidi`)) engine = IndiBible Default Charge = UTF8; / *! 40101 SET character_set_client = @saved_cs_client * /; But this query takes different time for different data. Apart from this, I mean to use the secondary index for the following question but it is not.
SELECT * from device device WHERE EqpmDataDBId & gt; 41500823 and LocationCustomId = '192.168.3.6-8050' and EquipmentCustomId = 'TP-3' and by EqpmDataDBId ASC limit 25
You can force the SQL Optimizer to use the available index on your table using the USE INDEX clause. Here is the document for the same: can be changed to something like your query The
select * EquipmentData where use index (ReadTime, secondary) EqpmDataDBId & gt ; 41500823 and LocationCustomId = '192.168.3.6-8050' and EquipmentCustomId = 'TP-3' and by EqpmDataDBId ASC limit 25 ChannelCustomId = 'Temp -0' order Hope this is your execution Reduces time.
Comments
Post a Comment