Use indexes and avoid LIKE (use fts table and MATCH instead)

Bug #1410823 reported by PerfectCarl
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Foto
Triaged
Undecided
Unassigned

Bug Description

Hello

I just had a look at your dao classes and if you care about performance, you should really read about database indexes and avoid LIKE statements.

In a more general way, you should pay attention to your query plan (EXPLAIN QUERY PLAN) to find out which query is slow.
(remember every query performs well as long as you don't deal with a significant amount of data).

You might be interested in full text table (FTS) that lets you do search for arbitrary strings while maintaining perf.

One last thing, don't use SELECT * because when you change your schema the query will crash with unhelpful error message (or worse won't crash but will produce corrupted results).
Instead name the columns explicitly. It will also help you find every place where a specific column is used.

Cheers,
C.

Revision history for this message
Erasmo Marín (erasmo-marin) wrote :

Yep, the select * is because Im so lazy. I'm going to do some research about FTS.

Changed in foto:
status: New → Triaged
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.