mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-28 17:01:14 +00:00
d3aaab0692b7b7f44f659385f027035d9d2335d4
Deleting a character runs one DELETE per table that has an identifier/owner column, all in a single transaction. Only users.identifier is indexed; the other core tables (billing, owned_vehicles, user_licenses, society_moneywash, addon_account_data, addon_inventory_items, datastore_data) have no usable index on the delete column, so each DELETE is a full table scan and they all hold locks at once. Measured on 200k rows per table (MariaDB 12.3.2): the transaction went from about 1573 ms to about 22 ms once the seven columns are indexed, EXPLAIN going from type=ALL scanning ~200k rows to a single-row index lookup per table. The addon and datastore tables were the worst because their composite indexes do not lead with the delete column, so they cannot serve WHERE owner = ?. Adds the indexes to legacy.sql for fresh installs and a migration for existing databases. The migration checks INFORMATION_SCHEMA for an index that leads with the column (SEQ_IN_INDEX = 1) and only creates one where it is missing, so it is a no-op on databases that already have it and re-running is guarded by the migration key.
ESX Legacy
Discord - Website - Documentation
Want more resources? You can browse the Cfx.re Releases board for more!
ESX is the leading framework, trusted by over 12,000 communities to provide the highest quality roleplay servers on FiveM
💗 Supporters
Interested in helping us? Take a look at our patreon
| We would like to sincerely thank the following donors who helped fund the development of ESX. |
|---|
| Mohamad Buhamad - Michael Hein - RoadToSix - Montree Narathong |
| Saydoon - Muhannad alyamani - iSentrie - Wecity - Samuel Nicol |
| Kyle McShea - Artin - Mathias Christoffersen - Jaylan Yilmaz - Callum |
| CONGRESS KW - Michael Hein - Smery sitbon - daZepelin - CMF Community |
Description
Languages
JavaScript
62.3%
Lua
34.8%
TypeScript
1.2%
HTML
0.8%
CSS
0.7%
Other
0.2%