freenode/#lisp - IRC Chatlog
Search
2:31:47
jmercouris
let me rephrase my question, let's say I had a bunch of items with specific tags, how can i query for items with tag x
2:33:10
Zhivago
Although if you want the tags to be primary keys, then they'll need to be in distinct columns.
2:34:23
Zhivago
You could set up another table for item-tag relationships, and then do an exciting join againt the item-data.
2:37:22
Zhivago
Then the tags could be in a single column and it would be potentially efficient to look up.
2:57:49
Zhivago
You'd end up with (item-id-1, tag-1), (item-id-1, tag-2), (item-id-2, tag-1), etc, tuples in the table.
2:58:43
Zhivago
Presumably the SQL system should be able to arrange its indexes to efficiently answer queries like "select item-id where tag='tag-1'".
2:59:30
jmercouris
Zhivago: I understand how that works for a single tag, but how could I query for multiple tags?
3:00:04
jmercouris
would I have to do multiple queries and a join? sorry for the questions, dbs are not one of my strong suits
3:07:18
pierpa
no, you do one query. The query optimizer of the DB will devise a way to perform the query efficiently
3:16:09
jmercouris
pierpa: is any of these the approach you describe? https://stackoverflow.com/questions/2885564/ways-to-implement-tags-pros-and-cons-of-each
3:18:57
jmercouris
pierpa: or did you mean this: https://stackoverflow.com/questions/3498844/sqlite-string-contains-other-string-query?
3:19:28
pierpa
I'm no DB expert, but I'd say way 1 and 3 are dumb, way 2 the only acceptable, but I may be wrong
3:21:52
pierpa
let me rephrase: way 3 is good, way 2 less so but is simpler and for small DBs may be viable, way 1 is dumb
3:22:24
jmercouris
so none of this:https://stackoverflow.com/questions/3498844/sqlite-string-contains-other-string-query
3:24:57
pierpa
do you really need to match substrings, or you considered this only as a possible approach?
3:25:42
jmercouris
it doesn't strongly matter to me how the data is matched, just that there are tags
3:26:02
jmercouris
pierpa: as of now, I am not doing it in any way, i haven't started on the implementation yet, just seeking advice before i start
3:26:30
jmercouris
I'm not sure how people will want to query their history, by date, by tags? by url?
3:26:34
pierpa
I think storing tags as a comma separated list of names in a string is not a good idea
5:29:33
mfiano
estimated from log file sizes with non-channel-messages stripped, for about a decade of data, that is.
5:31:30
mfiano
It has been a bit less active the last month or 2, but that is expected to pick up again next month when the jam starts. might be a good time to mention if anyone is interested: https://itch.io/jam/lisp-game-jam-2017-hard-mode
6:23:24
Shinmera
hjudt: If you have few pages, make a file per page. If you have lots with little code, make one file that activates the code depending on which page you're on.