sql - MySQL table and query optimization -



sql - MySQL table and query optimization -

the next table: gps_gotaxiking

+-----------+---------------------+------+-----+---------+----------------+ | field | type | null | key | default | | +-----------+---------------------+------+-----+---------+----------------+ | recordid | bigint(20) unsigned | no | pri | null | auto_increment | | carno | varchar(10) | no | mul | null | | | valid | varchar(48) | no | | null | | | lon | varchar(13) | no | | null | | | lat | varchar(13) | no | | null | | | angle | varchar(10) | no | | null | | | speed | varchar(10) | no | | null | | | carstatus | varchar(10) | no | | null | | | time | datetime | no | | null | | +-----------+---------------------+------+-----+---------+----------------+

current 100 1000000 rows info in database. , queried using next code:

select lat, lon gps_gotaxiking `carno` = "xxxx" , time between 'yyyy-mm-dd 00:00:00' , 'yyyy-mm-dd 23:59:59' , valid = 'normal';

i can result, homecoming time above 1 min, there way simplify query , cut down process time?

put key on columns valid , time. think using integer columns valid! access time should below second.

mysql sql

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -