I'm open to suggestions... Not sure if I'll access it with PHP or Python yet (probably the former). I was leaning towards MariaDB since I've already used this, but one of my friends is using PostgreSQL a lot, and says I should switch each time, it may be a good opportunity.What database are you using?
And use IN keyboard? Or something else? Thanks, will look into this...For instance, with PostgreSQL there's also the possibility of storing the keywords/tags as a string array (VARCHAR[]) on the document table directly.
Edit: scratch that... Just found the @>. That's handy!
You may have done in 5 minutes what my friend haven't been able to do in 5 years
That's *exactly* what I was looking for... No doubt, this thread delivers, as usual A huge thank.I read a performance comparison (for PostgreSQL) not too long ago because I had the same problem: http://www.databasesoup.com/2015/01/tag-all-things.html
Though I wonder... The "Id" solution seems to be slow because he's doing a join... I probably would have used a select to get the IDs of keyword, then used the IDs in searchs, not doing a join. I expected this:
- to be faster than the "Text" approach, because comparing integers should be slightly faster than comparing chains (although barely)
- to be more compact than the "Text" approach, but this shows clearly it's not the case
So at least, I've already learned something, even not taking into account the more advanced strategies. Great read...