I have a table that shows the users currently connected to a system, but I receive 100 new connections every minute, and also, about 100 users leave the site every minute. If I had to query for a particular column, is it convenient to create a secondary index for that given column? (considering that the table content changes every minute).
Would it make any difference if the query was an aggregation (like the count of users at a given hour)?
Thanks!
You should create indexes on columns as required by your queries.
Take into consideration that every index you have on a table will increase load on the server for update/insert queries. You must weigh up the performance benefits of having the index with the decrease in performance for modification queries.
Trial and error can be a good approach.