0

in a web application where people talk to each other , there will be a lot of messages , suppose for simplicity that each row in a table is a message ,

do you think if a have 5 million messages that one table is enough for them all ? or should i have 5 tables of one million each ?

the server used will be a simple vps or small dedicated server with 8Gb of ram ,two cores processor 2.5Ghz frequency , ssd ,

1
  • 5kk records is average size. In any case do not split the data into a lot of tables. You may use table partitioning if it is reasonable - but this is dependent by a list of operations (except insertion, of course) with your data.
    – Akina
    Feb 26, 2019 at 11:48

1 Answer 1

1

Yes, one table is probably enough. You don't usually gain anything by splitting the messages into multiple tables, i.e. horizontal partitioning. On the contrary, it will usually make your queries more complex and slower.

However, horizontal partitioning does make each index smaller, thereby potentially resulting in faster queries provided your data is segregated into e.g. different countries or regions, and you have an obvious, robust, implicit way to identify in which table a particular row will be found without first needing to search the index.

But in most cases, a single table is what you want.

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.