Used: Comp: - 2.6GHz - 6.0 GB of RAM - Win 7x64
Programs:
- OpenServer
- Access - 2016
- MySql 5.7 x 64
- Odbc - mysql-connector-odbc-5.3.7-winx64
Everything is installed and used on one computer
Characteristics of the table:
- number of lines assumed - more than 1.0 million
- number of columns ~ 20 pieces
Table (tbl8)
Count lines - 12,425 lines
Volume - 24.6 MB
CREATE TABLE `tbl5` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `tbl` LONGTEXT NULL, `idsub` INT(20) NOT NULL, `pol_3` INT(11) NULL DEFAULT NULL, `pol_4` LONGTEXT NULL, `pol_5` LONGTEXT NULL, `pol_6` LONGTEXT NULL, `pol_7` LONGTEXT NULL, `pol_8` LONGTEXT NULL, `pol_9` LONGTEXT NULL, `pol_10` LONGTEXT NULL, `pol_11` LONGTEXT NULL, `pol_12` LONGTEXT NULL, `pol_13` LONGTEXT NULL, `pol_14` LONGTEXT NULL, `pol_15` LONGTEXT NULL, `pol_16` LONGTEXT NULL, `pol_17` LONGTEXT NULL, UNIQUE INDEX `id` (`id`) ) COLLATE='utf8_general_ci' ENGINE=InnoDB AUTO_INCREMENT=240013 ; In the table, the field type "LONGTEXT" is taken as a preliminary, for checking the operation of the database ... Then the necessary types will be assigned to the fields: LONGTEXT, TEXT, numbers, dates, etc. In the fields: pol_9, pol_10, pol_11 a lot of lower case text of more than 1,000 characters is used. In the remaining fields, just the text "TEXT _ RECORDS pol_n"
Request
Execute the query in the HeidiSql program from the tbl8 table
select* from `01tst`.`tbl8` where ( `01tst`.`tbl8`.`idsub` = 2 ) The request is executed 2 seconds.
When the number of lines reaches more than 100,000 - the duration of the query 40 seconds.
Question
How to reduce the duration of the request?
What influences the duration of the request?
UNIQUE, but byPRIMARY- SLy_huhidsub. Since it is filtered by it, it can help a lot - KoVadimidnotprimary key? And there is no index onid_sub. - vp_arth