You can never worry about resources, when you start creating an application, you should always have resources, space, speed, etc. if your website traffic increases dramatically and you never build resources, then you start to get into problems .
As for the voting system, I personally would have kept such votes:
table: product table: user table: user_product_vote +----+-------------+ +----+-------------+ +----+------------+---------+ | id | product | | id | username | | id | product_id | user_id | +----+-------------+ +----+-------------+ +----+------------+---------+ | 1 | bananas | | 1 | matthew | | 1 | 1 | 2 | | 2 | apples | | 2 | mark | | 2 | 2 | 2 | | .. | .. | | .. | .. | | .. | .. | .. |
Causes:
Firstly, user_product_vote does not contain text, drops, etc., it is purely whole, so it still takes less resources.
Secondly, you have more doors for new objects in your application, such as Total votes in 24 hours, Highest product rating in the last 24 hours, etc.
Take this example, for example:
table: user_product_vote +----+------------+---------+-----------+------+ | id | product_id | user_id | vote_type | time | +----+------------+---------+-----------+------+ | 1 | 1 | 2 | product |224.. | | 2 | 2 | 2 | page |218.. | | .. | .. | .. | .. | .. |
And a simple request:
SELECT COUNT(id) as total FROM user_product_vote WHERE vote_type = 'product' AND time BETWEEN(....) ORDER BY time DESC LIMIT 20
Another thing is if the user voted for 1AM and then tried to vote in 2PM again, you can easily check when they last voted and if they are allowed to vote again.
There are so many features that you are missing if you stick with your incremental example.
As for your count() , no matter how you optimize your queries, this will not affect large scale much.
With an extremely large user base, your use of resources will be considered from a different perspective, for example, load balancers, mainly server settings, Apache, trap, etc., there is only so much you can do with your requests.