Good morning,
I am at the moment writing my master thesis and hence I have to justify each an every general assessment I make.
I have a flat database in MySQL which was originally composed of the following fields
- Date (DATETIME)
- Name (VARCHAR(50))
- Value (DOUBLE)
The PK of the table was a composite of the columns 1 and 2.
The thing is that I soon had more than 40 millions rows and my queries for all records over a single name were taking ages.
Hence, I decided to create an "index table" (I think the terminology is correct) where I store a mapping between Names and IDs:
- ID (INT)
- Name (VARCHAR 50)
And I changed my initial table to
- Date (DATETIME)
- ID (INT)
- Value (DOUBLE)
This way I could first find the ID of the record I was looking for, and then run a query over the large table very quickly (performance was really much better).
I assume this is because comparison between integer is much easier than between character strings, but I was looking for some literature to back this assessment (ideally some database structure book).
Do you think my assessment is correct?
MOST IMPORTANTLY
Does anyone know a good book I could read:
- about indexing performance for Databases
- about performance comparison between integers and character strings on equality tests.