Hi all,
I was wondering what the best way of storing user queries correlated with timestamps in MySQL was. Let's say I have just two inputs, a user's "query" and "timestamp"...
I could create a MySQL table with fields (id
, query
, count
, timestamp_list
), where:
id
is unique identifier of the query,
query
is the literal query string,
count
is the (constantly-UPDATEd) number of times that query is entered, and
timestamp_list
is a LONGTEXT or something with a list of times that query was searched.
Is there a better way to correlate these using indexing I'm not familiar with? It seems like storing a list of timestamps in a LONGTEXT is dumb, but easy; perhaps I should create a separate table like:
id
query_id
(correlates to id
in first table)
timestamp
And I can join results with the first table. Any thoughts? Thanks!