vendredi 29 mai 2015

SQLite best way to save and traverse arrays of strings

I have a table that looks like this.

   | id | coords |
   |  0 | [1,0],[4,3],[4,9],[9,3],[1,8]     
   |  1 | [3,6],[3,8],[7,4],[5,2],[2,1]
   .. and more

There will be around 70k-100k rows at most, and the CPU is not very powerful.

What is the fastest and least cpu intensive SQLite statement i can use to determine which id has any given coordinate? No two id's share a coordinate.

Example.

SELECT * FROM mytable WHERE coords LIKE '%[[]3,8]%'

I imagine the LIKE statement above will get pretty intensive right?

Aucun commentaire:

Enregistrer un commentaire