Project

General

Profile

Actions

Feature #24307

closed

sys_history: optimize indexes

Added by Juergen Deisenroth over 13 years ago. Updated about 13 years ago.

Status:
Closed
Priority:
Should have
Category:
Database API (Doctrine DBAL)
Target version:
-
Start date:
2010-12-07
Due date:
% Done:

0%

Estimated time:
PHP Version:
5.3
Tags:
Complexity:
Sprint Focus:

Description

The combined database key "recordident (tablename,recuid,tstamp)" for the table "sys_history" at the the file "typo3_src-4.5.0beta2/t3lib/stddb/tables.sql" works like the three single keys:
recordident_1 (tablename)
recordident_2 (tablename,recuid)
recordident_3 (tablename,recuid,tstamp)
But there is no sql statement using all three columns and the key generation is wasting resources. It should be changed to "recordident (tablename,recuid)". A second reason for the change is the high cardinality for the combination of tablename and recuid, so the third column has no positive effect.

Add a new key "tstampident (tablename,tstamp)" for clearing the history at t3lib_TCEmain::clearHistory() because the delete statement (WHERE tstamp<... AND tablename=...) uses only the first column "tablename" from the key "recordident" with a very poor cardinality at a large history table.

On our system the slow query reported at http://bugs.typo3.org/view.php?id=14852 is gone.
(issue imported from #M16698)


Files

16698.diff (467 Bytes) 16698.diff Administrator Admin, 2011-01-13 15:28
16698_02.diff (538 Bytes) 16698_02.diff Administrator Admin, 2011-01-13 23:20

Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #22986: Slow query in sys_history due to missing key on tstamp / tablenameClosedChristian Kuhn2010-06-24

Actions
Actions

Also available in: Atom PDF