summaryrefslogtreecommitdiff
path: root/topics
diff options
context:
space:
mode:
authorPjotr Prins2021-12-30 06:52:28 +0100
committerPjotr Prins2021-12-30 06:52:28 +0100
commit995507d63185c93e20e7c5ff905914535eb11e33 (patch)
tree53e9399a9f946e447a22dc4481014e87e1754b6a /topics
parent0398a7c5f39b546dacaee54562ac23391ddb752b (diff)
downloadgn-gemtext-995507d63185c93e20e7c5ff905914535eb11e33.tar.gz
Innodb and ProbeSetXREf
Diffstat (limited to 'topics')
-rw-r--r--topics/systems/mariadb/ProbeSetXRef.gmi58
-rw-r--r--topics/systems/mariadb/move-to-innodb.gmi12
2 files changed, 69 insertions, 1 deletions
diff --git a/topics/systems/mariadb/ProbeSetXRef.gmi b/topics/systems/mariadb/ProbeSetXRef.gmi
index d9adad1..db0be0a 100644
--- a/topics/systems/mariadb/ProbeSetXRef.gmi
+++ b/topics/systems/mariadb/ProbeSetXRef.gmi
@@ -60,18 +60,74 @@ MariaDB [db_webqtl]> select count(*) from ProbeSetXRef;
```
rg ProbeSetXRef --color=always |less -R
+rg ProbeSetXRef --type=py -l|fzf --preview="rg --color=always -A 20 ProbeSetXRef {}" --preview-window=right:85%:wrap
```
+In SQL where statements these are usually combined
+
+ProbeSetXRef.ProbeSetFreezeId
+ProbeSetXRef.ProbeSetId
+
+and sometimes
+
+ProbeSetXRef.DataId
+ProbeSetXRef.Locus
+
+As can be seen from above table definition the indices are matching
+
+```
+ UNIQUE KEY 'ProbeSetId' ('ProbeSetFreezeId','ProbeSetId'),
+ UNIQUE KEY 'DataId_IDX' ('DataId'),
+ KEY 'Locus_IDX' ('Locus')
+```
+
+The combination of
+
+```
+select count(distinct ProbeSetFreezeId,ProbeSetId) from ProbeSetXRef limit 10;
+```
+
+is unique.
+
+
### Create test
Some select statement and maybe a page of GN2.
+```
+MariaDB [db_webqtl]> select count(*) from ProbeSetXRef where ProbeSetFreezeId<200 and ProbeSetId<1000 and pValue>0.5;
++----------+
+| count(*) |
++----------+
+| 19068 |
++----------+
+1 row in set (1.752 sec)
+
+MariaDB [db_webqtl]> select count(*) from ProbeSetXRef where ProbeSetFreezeId<300 and ProbeSetId<1000 and pValue>0.5;
++----------+
+| count(*) |
++----------+
+| 19068 |
++----------+
+1 row in set (13.781 sec)
+```
+
+Note the second query traverses the full file.
+
### Create primary key
```
ALTER TABLE ProbeSetXRef
- ADD PRIMARY KEY(col1,col2);
+ ADD PRIMARY KEY(ProbeSetFreezeId,ProbeSetId);
+```
+
+@@
+
```
+MariaDB [db_webqtl]> DROP INDEX ProbeSetId ON ProbeSetXRef;
+MariaDB [db_webqtl]> show index from ProbeSetXRef;
+```
+
### Create indices
### Convert to innodb
diff --git a/topics/systems/mariadb/move-to-innodb.gmi b/topics/systems/mariadb/move-to-innodb.gmi
index f93aace..f5011cb 100644
--- a/topics/systems/mariadb/move-to-innodb.gmi
+++ b/topics/systems/mariadb/move-to-innodb.gmi
@@ -348,6 +348,11 @@ Prototocol from
Every table update has to follow the template:
+### Check recent backups
+
+* [ ] ascertain there is a backup
+* [ ] copy original files
+
### Check table structure
```
@@ -366,6 +371,7 @@ select count(*) from MYTABLE;
```
rg MYTABLE --color=always |less -R
+rg MYTABLE --type=py -l|fzf --preview="rg --color=always -A 20 MYTABLE {}" --preview-window=right:85%:wrap
```
### Create test
@@ -380,6 +386,12 @@ ALTER TABLE MYTABLE
```
### Create indices
+
+```
+SHOW INDEX FROM MYTABLE;
+DROP INDEX ProbeSetId ON MYTABLE;
+```
+
### Convert to innodb
```