Primary Key Performance Impact in SQLite

I have a sqlite database used to store information about backup jobs. Each run increases by about 25 mb as a result of adding about 32,000 records to a particular table.

This table is a "map table" used to associate certain information with records in another table ... and it has a primary key (int autoincrement) that I do not use.

sqlite will reserve 1, 2, 4, or 8 bytes for an INT column, depending on its value. This table contains only 3 additional columns, as well as an INT type.

I added indexes to the database by columns, which I use as filters (WHERE) in my queries.

If there are indices, etc. and in the situation described, do primary keys have any useful performance advantage?

Note. Performance is very important for this project - but not if 10 ms stored in 32,000 write jobs means an extra 10 MB of data!

+3
source share
2 answers

The primary key index is used to find the row for a given primary key. It is also used to ensure that primary key values ​​are unique.

, , , . .

INSERT UPDATE . .

+2

, + ? , , , .

- , . , insert. , . , , MySQL Oracle - concurrency, sqlite.

0

Source: https://habr.com/ru/post/1714473/


All Articles