4 ms·
I don't know much about SQL, but are you sure you need multiple joins for that? I'd do something like this (psuedocode) on the table with the tags: SELECT f
by b3n 11y ago
I don't know much about SQL, but are you sure you need multiple joins for that?
I'd do something like this (psuedocode) on the table with the tags:
SELECT foreign-id, COUNT(*)
FROM Tags
WHERE tag IN ('foo', 'bar', 'baz')
GROUP BY foreign-id
HAVING COUNT(*) = 3
It does seem rather hacky though.
- Veratyr 11y agoHmm, I don't know much about it either and it looks like you're right. I don't believe that querying it is nearly as fast as querying a GIN index (or as easy) still. With Postgres I just do this and it gives me a result in a couple ms: SELECT * FROM things WHERE ARRAY['tag1', 'tag2'] <@ tags;