K
K
krov1192018-10-12 15:48:06
SQL
krov119, 2018-10-12 15:48:06

What does a query look like in message boards that determines whether a user has an ad in bookmarks or not?

Hello. Here in the bulletin boards you can choose, for example, ads of a certain category for the entire period, for example, and there, of course, hundreds of thousands or even millions of ads. Surely, a few thousand are loaded first, and only then, if necessary, the rest. But even if several thousand are loaded first, then for each necessary one, determine whether this ad is bookmarked by the user or not, in order to tint an asterisk / heart (a sign of being bookmarked / favorites). The question is, how do they do it? The obvious solution is when the user_bookmarks table is joined to the selected ads, but for such volumes of data, how is the result returned so quickly? this is one query to the ads table, one query to the user_bookmarks table to cut by user, and then join the two results. In general, there is a feeling that everything is much simpler and cooler there, so if anyone knows, please share the info, I will be grateful)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2018-10-12
@dimonchik2013

normal xor between two IDs

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question