DIRACGrid / DIRACGrid/DIRAC

TaskQueueDB: no need for `TaskIndex` indexes, they can be dropped altogether.

Open
#8,468 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
126
Forks
191
Avg merge
1d 13h
Merged PRs (30d)
33

Description

The TQId,Value pair is the PRIMARY KEY in this table. So, the corresponding index is anyway created.
It is probably just better to drop the "TaskIndex": ["TQId"]

As additional context, this is what I see in the certification setup:

```
Dirac@dbod-dcertif.cern.ch
(MySQL):TaskQueueDB>describe `tq_TQToBannedSites`
+-------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+--------------+------+-----+---------+-------+
| TQId | int unsigned | NO | PRI | | |
| Value | varchar(64) | NO | PRI | | |
+-------+--------------+------+-----+---------+-------+

2 rows in set
Time: 0.011s
Dirac@dbod-dcertif.cern.ch
(MySQL):TaskQueueDB>show INDEX FROM `tq_TQToBannedSites`
+--------------------+------------+------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+---------+------------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment | Visible | Expression |
+--------------------+------------+------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+---------+------------+
| tq_TQToBannedSites | 0 | PRIMARY | 1 | TQId | A | 0 | | | | BTREE | | | YES | |
| tq_TQToBannedSites | 0 | PRIMARY | 2 | Value | A | 0 | | | | BTREE | | | YES | |
| tq_TQToBannedSites | 1 | TaskIndex | 1 | TQId | A | 0 | | | | BTREE | | | YES | |
| tq_TQToBannedSites | 1 | BannedSitesIndex | 1 | Value | A | 0 | | | | BTREE | | | YES | |
+--------------------+------------+------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+---------+------------+

```

_Originally posted by @fstagni in https://github.com/DIRACGrid/DIRAC/pull/8462#discussion_r2845456126_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.