Storage strategy for combination of all table items
Here's a way to count how many of each pair of items is upvoted:

CREATE TABLE pairs (
    item1 ...,
    item2 ...,
    ct INT
    PRIMARY KEY(item1, item2) )

INSERT INTO pairs
     (item1, item2, ct)
     VALUES
     (?, ?, 1)   -- value list
ON DUPLICATE KEY UPDATE
     ct = ct + 1;


It has a flaw of saying the pair (x,y) is different than (y,x).  If that matters, there are two workarounds:

On input:  Change "column list" to

    (LEAST(?,?), GREATEST(?,?), 1)


Or, on output: combine the counts for matching pairs.

(I don't know why you mentioned "users".)