DEV Community


Posted on

Choosing a storage solution for simple user input

Hi everyone,

here's an engineer-y question for you regarding lead generation online.

Say you had to collect your visitors' name & email through a landing page opt-in. What storage mechanism would you use:

  • a JSON file
  • a key-value store
  • a relational DB?

My current solution is a JSON file, however it's not very efficient because when saving a new entry, you need to parse all the existing ones into an Array from JSON, add the new data, then again serialize the entire collection as JSON, then write it back to the file.

Also, if I'm going to do uniqueness tests (no double entries allowed for email, for example), I'll have to traverse the entire array to find the duplicate — I suspect this is more efficiently handled by the other two storage mechanisms (hash-based lookup in constant time).

Thanx for your input!

Discussion (0)