Will I run into performance issues if I use a blob field as primary key in SQLite?

performance, sql, sqlite

Solution

The best way to find out is to run the queries against a profiler/SQLite's timer. Setup a test and run the query 1000 times with string, then 1000 times as a blob. Winner is the fastest.

Intuition is one thing, hard data is another.

Problem

I have a sqlite database where all the primary keys are GUIDs. Currently they are stored as fixed length strings but I want to store them as blobs because it simplifies the code for storing and retrieving data. I converted part of the database and everything is functioning as expected. However, I'm not sure if I will run into performance issues. For example, would a statement like this be faster on strings than blobs? ``` SELECT * FROM table1 t1, table2 t2 WHERE t1.id = t2.parent_id ``` My intuitions says no, but that doesn't really mean anything.

Original source

Related problems