V
V
Vladimir Korotenko2020-03-12 13:08:04
MySQL
Vladimir Korotenko, 2020-03-12 13:08:04

What is the most winning strategy for counting likes?

Actually the question of speed when counting likes. The structure is as follows: table images
imgid,
Likeup
likedown
Table likes
I'd
Userid
Up
Direction
Created
Imageid
Indexes are configured on all IDs
As a result, is it worth bothering by making a trigger to insert like and update roles in the images table or just select count on the result set with each request . Image datasets 1000+ likes for each up to 10000+ General table of likes 10M records

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
noremorse_ru, 2020-03-12
@firedragon

Winning for what? Of course, it's faster to get an int than to aggregate every time

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question