I am facing strange Slowness some times it says #1205 – Lock wait timeout exceeded; try restarting transaction & in my specific MYSQL table.
I have below table which have id and TBO_code as index as shown below in the structure along with more than 150000 rows data
--
-- Table structure for table `TBO_hotels`
--
CREATE TABLE `TBO_hotels` (
`id` bigint(20) NOT NULL,
`TBO_code` varchar(50) DEFAULT NULL,
`name` varchar(255) NOT NULL,
`address` text NOT NULL,
`Map` varchar(255) NOT NULL,
`city_code` varchar(255) NOT NULL,
`country` varchar(255) NOT NULL,
`zip_code` varchar(50) NOT NULL,
`city_name` varchar(255) DEFAULT NULL,
`rating` varchar(255) DEFAULT NULL,
`HotelFacilities` text DEFAULT NULL,
`contact_phone` varchar(255) DEFAULT NULL,
`country_code` varchar(255) DEFAULT NULL,
`featured_image` varchar(255) DEFAULT NULL,
`images` text DEFAULT NULL,
`description` text DEFAULT NULL,
`Attractions` text DEFAULT NULL,
`CheckInTime` text NOT NULL,
`CheckOutTime` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `TBO_hotels`
--
ALTER TABLE `TBO_hotels`
ADD PRIMARY KEY (`id`),
ADD KEY `TBO_code` (`TBO_code`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `TBO_hotels`
--
ALTER TABLE `TBO_hotels`
MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;
COMMIT;
when i otry to search Rows with respect to column city_code
(column value use in other city codes main table), it gives respond very slow
even if i just simply browse table or try to sort with phpmyadmin,
below is an example query, I searched the global variable and found nothing strange in global settings aswell.
Even i already have the correct index data but response is slow in that particular table.
please guide me what i am doing wrong in this table?
SELECT *,
(SELECT count(TBO_code) fromTBO_hotels
where city_code =115936
) as TotalCount
FROM TBO_hotels
where city_code = 115936
ORDER BY id ASC
LIMIT 0,50;
I do not understand what i am doing wrong, as all seems correct.
Please can some one guide me?