0

I have php application like airbnb. I want to store search values each time user search for listings.

my number 1 solution would be storing it in mysql table, but I'm not sure its wise to do, if site has lots of searchs wouldn't it will slow things down.

should I use mysql or something else?

  • 1
    What, specifically, would you like to store? The user's ID, the datetime of the search and the search string? How long would you like to keep it? How many users (approx)? – mendosi Nov 13 '16 at 5:25
  • This question is abit too broad without more background information. Are you using mysql for the rest of your app? If so, using an entirely different DBMS might be abit overkill. – deacs Nov 13 '16 at 17:12
  • search string and all the filters that are getting used (20+ filters). Yes we are using mysql through out. – Basit Nov 13 '16 at 22:57
  • SHOW CREATE TABLE and show a typical SELECT. – Rick James Nov 16 '16 at 0:20
1

Storing in table should be fine. You need to consider how the data is going to be accessed and retrieved when you're designing the table and indexes on it. I'd say that you're likely to be doing queries which return all of the past searches for a particular user (or perhaps even just the most recent by user) so it would probably make sense to cluster the table by UserID and SearchDate. This design should also help reduce contention if lots of inserts are happening at the same time since each user will be inserting into a different part of the table.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.