First of all, I suggest you perform a performance test - write a program that generates test records that match the number of records that you will see in six months, insert them and check the results to find out if they are satisfactory. If not, try indexing as suggested by other answers. By the way, itβs also worth trying to write down the performance so that you can actually insert the amount of data that you generate in 15 minutes .. 15 minutes or less.
Carrying out the test will allow the mother to avoid all problems - assumptions :-)
Also think about product performance β your pilot will have 2,000 users β will your production environment have 4,000 users, or 200,000 users in a year or two?
If we are talking about a really large environment, you need to think about a solution that allows you to scale by adding more nodes instead of relying on the ability to add more CPU, disk and memory to the same machine. You can do this in your application by tracking which of several database machines the information about a particular user is located on, or you can use one of the Postgresql clustering methods, or you can go a completely different way - NoSQL , where you completely leave the DBMS and use systems that are built to scale horizontally.
There are a number of such systems. I have only personal experience with Cassandra . You have to think in a completely different way from what you are used to in the world of RDBMS, which is something complicated - think more about how you want to access data, and not to store it. For your example, I think that storing the data with the user ID as the key, and then adding a column with the column name being the timestamp, and the column value being your data for this timestamp would make sense. Then you can query for fragments of these columns, for example, to get the results of a graphical display in the web interface. Cassandra has reasonably good response time for user interface applications.
The potential for investing in learning and using the nosql system is that when you need more space, you simply add a new node. The same thing if you need more write performance or more read performance.
source share