Here is my table :
MariaDB [pmacontrol]> show create table mysql_server\G
|
*************************** 1. row ***************************
|
Table: mysql_server
|
Create Table: CREATE TABLE `mysql_server` (
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
`id_client` int(11) NOT NULL,
|
`id_environment` int(11) NOT NULL,
|
`name` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
|
`display_name` varchar(100) NOT NULL,
|
`ip` char(15) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL,
|
`hostname` varchar(200) NOT NULL DEFAULT '',
|
`login` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
|
`passwd` varchar(255) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL,
|
`database` varchar(64) NOT NULL,
|
`is_password_crypted` int(11) NOT NULL,
|
`port` int(11) NOT NULL,
|
`ssh_port` int(11) NOT NULL DEFAULT 22,
|
`ssh_login` text CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '\'\'',
|
`is_sudo` int(11) NOT NULL DEFAULT 0,
|
`is_root` int(11) NOT NULL DEFAULT 1,
|
`is_monitored` int(11) NOT NULL DEFAULT 1,
|
`is_proxy` int(11) NOT NULL DEFAULT 0,
|
`is_available` int(11) NOT NULL DEFAULT 0 COMMENT '-1= not asnwered, 0 = HS, 1=OK',
|
`is_acknowledged` int(11) NOT NULL DEFAULT 0,
|
`error` text NOT NULL DEFAULT '',
|
`warning` text NOT NULL DEFAULT '',
|
`date_refresh` datetime NOT NULL DEFAULT current_timestamp(),
|
`ssh_available` int(11) NOT NULL DEFAULT 0 COMMENT '-1= not asnwered, 0 = HS, 1=OK',
|
`ssh_date_refresh` datetime NOT NULL DEFAULT current_timestamp(),
|
`ssh_error` text NOT NULL DEFAULT '',
|
PRIMARY KEY (`id`),
|
UNIQUE KEY `name` (`name`),
|
UNIQUE KEY `ip` (`ip`,`port`),
|
KEY `id_client` (`id_client`),
|
KEY `id_environment` (`id_environment`),
|
KEY `is_monitored` (`is_monitored`,`id_client`),
|
CONSTRAINT `mysql_server_ibfk_1` FOREIGN KEY (`id_client`) REFERENCES `client` (`id`),
|
CONSTRAINT `mysql_server_ibfk_2` FOREIGN KEY (`id_environment`) REFERENCES `environment` (`id`)
|
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci WITH SYSTEM VERSIONING
|
1 row in set (0,000 sec)
|
the number of line in my table :
MariaDB [pmacontrol]> select table_name, table_rows from information_schema.tables where table_name = 'mysql_server';
|
+--------------+------------+
|
| table_name | table_rows |
|
+--------------+------------+
|
| mysql_server | 16377356 |
|
+--------------+------------+
|
1 row in set (0,001 sec)
|
Ok about 16 377 356 (with system versioning), but without this my table is about *13 lines *
when i try to the lines :
MariaDB [pmacontrol]> select count(1) from mysql_server;
|
+----------+
|
| count(1) |
|
+----------+
|
| 13 |
|
+----------+
|
1 row in set (25,079 sec)
|
OMG ! 25 secondes, if ask for lines it's about (4 min 5,566 sec)
now if ask distinct on table :
MariaDB [pmacontrol]> select distinct id from mysql_server;
|
+----+
|
| id |
|
+----+
|
| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
+----+
|
13 rows in set (0,000 sec)
|
cool it's pretty fast !
work around i found :
MariaDB [pmacontrol]> select count(1) from (select distinct id from mysql_server) as gg;
|
+----------+
|
| count(1) |
|
+----------+
|
| 13 |
|
+----------+
|
1 row in set (0,001 sec)
|
For select * from mysql_server => 4 min 5,566 sec
work around :
with t as (select distinct id from mysql_server) select * from mysql_server a inner join t on a.id=t.id;
|
|
13 rows in set (0,001 sec)
|
If I can find a workaround in mysql, I am sure you can increase the performance internally !
{"report":{"fcp":1117.8999998569489,"ttfb":476,"pageVisibility":"visible","entityId":128557,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":32,"apdex":0.5,"journeyId":"96631e38-83e8-4b53-ba52-14b36ec83e94","navigationType":0,"readyForUser":1237.2999999523163,"redirectCount":0,"resourceLoadedEnd":1359.2999999523163,"resourceLoadedStart":481.5,"resourceTiming":[{"duration":74.09999990463257,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":481.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":481.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":555.5999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":76.39999985694885,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":481.7999999523163,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":481.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":558.1999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":154,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":482,"connectEnd":482,"connectStart":482,"domainLookupEnd":482,"domainLookupStart":482,"fetchStart":482,"redirectEnd":0,"redirectStart":0,"requestStart":482,"responseEnd":636,"responseStart":636,"secureConnectionStart":482},{"duration":238.70000004768372,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true&whisper-enabled=true","startTime":482.09999990463257,"connectEnd":482.09999990463257,"connectStart":482.09999990463257,"domainLookupEnd":482.09999990463257,"domainLookupStart":482.09999990463257,"fetchStart":482.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":482.09999990463257,"responseEnd":720.7999999523163,"responseStart":720.7999999523163,"secureConnectionStart":482.09999990463257},{"duration":242.39999985694885,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":482.2999999523163,"connectEnd":482.2999999523163,"connectStart":482.2999999523163,"domainLookupEnd":482.2999999523163,"domainLookupStart":482.2999999523163,"fetchStart":482.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":482.2999999523163,"responseEnd":724.6999998092651,"responseStart":724.6999998092651,"secureConnectionStart":482.2999999523163},{"duration":242.79999995231628,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":482.39999985694885,"connectEnd":482.39999985694885,"connectStart":482.39999985694885,"domainLookupEnd":482.39999985694885,"domainLookupStart":482.39999985694885,"fetchStart":482.39999985694885,"redirectEnd":0,"redirectStart":0,"requestStart":482.39999985694885,"responseEnd":725.1999998092651,"responseStart":725.1999998092651,"secureConnectionStart":482.39999985694885},{"duration":242.80000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":482.69999980926514,"connectEnd":482.69999980926514,"connectStart":482.69999980926514,"domainLookupEnd":482.69999980926514,"domainLookupStart":482.69999980926514,"fetchStart":482.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":482.69999980926514,"responseEnd":725.5,"responseStart":725.5,"secureConnectionStart":482.69999980926514},{"duration":299.40000009536743,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":482.89999985694885,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":482.89999985694885,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":782.2999999523163,"responseStart":0,"secureConnectionStart":0},{"duration":243,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":483,"connectEnd":483,"connectStart":483,"domainLookupEnd":483,"domainLookupStart":483,"fetchStart":483,"redirectEnd":0,"redirectStart":0,"requestStart":483,"responseEnd":726,"responseStart":726,"secureConnectionStart":483},{"duration":299.30000019073486,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":483.19999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":483.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":782.5,"responseStart":0,"secureConnectionStart":0},{"duration":243.20000004768372,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":483.2999999523163,"connectEnd":483.2999999523163,"connectStart":483.2999999523163,"domainLookupEnd":483.2999999523163,"domainLookupStart":483.2999999523163,"fetchStart":483.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":483.2999999523163,"responseEnd":726.5,"responseStart":726.5,"secureConnectionStart":483.2999999523163},{"duration":447.2999999523163,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":488.39999985694885,"connectEnd":488.39999985694885,"connectStart":488.39999985694885,"domainLookupEnd":488.39999985694885,"domainLookupStart":488.39999985694885,"fetchStart":488.39999985694885,"redirectEnd":0,"redirectStart":0,"requestStart":488.39999985694885,"responseEnd":935.6999998092651,"responseStart":935.6999998092651,"secureConnectionStart":488.39999985694885},{"duration":857.6999998092651,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":488.5,"connectEnd":488.5,"connectStart":488.5,"domainLookupEnd":488.5,"domainLookupStart":488.5,"fetchStart":488.5,"redirectEnd":0,"redirectStart":0,"requestStart":488.5,"responseEnd":1346.1999998092651,"responseStart":1346.1999998092651,"secureConnectionStart":488.5},{"duration":255.90000009536743,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":806.1999998092651,"connectEnd":806.1999998092651,"connectStart":806.1999998092651,"domainLookupEnd":806.1999998092651,"domainLookupStart":806.1999998092651,"fetchStart":806.1999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":806.1999998092651,"responseEnd":1062.0999999046326,"responseStart":1062.0999999046326,"secureConnectionStart":806.1999998092651},{"duration":275.2999999523163,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2cib/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/css/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":1072,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1072,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1347.2999999523163,"responseStart":0,"secureConnectionStart":0},{"duration":275,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/e65b778d185daf5aee24936755b43da6/_/download/contextbatch/js/browser-metrics-plugin.contrib,-_super,-project.issue.navigator,-jira.view.issue,-atl.general/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":1072.8999998569489,"connectEnd":1072.8999998569489,"connectStart":1072.8999998569489,"domainLookupEnd":1072.8999998569489,"domainLookupStart":1072.8999998569489,"fetchStart":1072.8999998569489,"redirectEnd":0,"redirectStart":0,"requestStart":1072.8999998569489,"responseEnd":1347.8999998569489,"responseStart":1347.8999998569489,"secureConnectionStart":1072.8999998569489},{"duration":286,"initiatorType":"script","name":"https://jira.mariadb.org/s/097ae97cb8fbec7d6ea4bbb1f26955b9-CDN/lu2cib/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/js/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true&whisper-enabled=true","startTime":1073.2999999523163,"connectEnd":1073.2999999523163,"connectStart":1073.2999999523163,"domainLookupEnd":1073.2999999523163,"domainLookupStart":1073.2999999523163,"fetchStart":1073.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":1073.2999999523163,"responseEnd":1359.2999999523163,"responseStart":1359.2999999523163,"secureConnectionStart":1073.2999999523163},{"duration":308.2000000476837,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1111.3999998569489,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1111.3999998569489,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1419.5999999046326,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":310,"responseStart":476,"responseEnd":482,"domLoading":479,"domInteractive":1370,"domContentLoadedEventStart":1370,"domContentLoadedEventEnd":1413,"domComplete":2169,"loadEventStart":2169,"loadEventEnd":2171,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1348.8999998569489},{"name":"bigPipe.sidebar-id.end","time":1349.6999998092651},{"name":"bigPipe.activity-panel-pipe-id.start","time":1349.7999999523163},{"name":"bigPipe.activity-panel-pipe-id.end","time":1352},{"name":"activityTabFullyLoaded","time":1457}],"measures":[],"correlationId":"e3e01854d42c87","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":93,"dbReadsTimeInMs":9,"dbConnsTimeInMs":18,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}