Answer the question
In order to leave comments, you need to log in
How to extract the common part from database queries?
Let's say we form a query to the database based on the received parameters (let's say for matches of 4 fields, let's call them from 1,2,3 and 4). And we also form a couple of requests but for the correspondence of three fields (let's say 1,2,3 and 2,3,4). We do not know in advance what additional requests will be generated and how many of them. How to extract the common part from all received requests (in this case, the correspondence of fields 2,3). The idea is to reduce the number of calls to the database, i.e. at the same time, we consider all the general conditions (2 and 3) and then arrange a check for individual (1 and 4) of those already selected.
And how to generate a code code that will be executed depending on the field being checked (i.e. let's say the field is not 4 but 5, i.e. the check must be performed in a certain way on field 5 when it is in the request, and not performed when it is not ).
More or less like this. Maybe in vain I want to read everything at once and then check it, maybe it would be better to have more requests but immediately select the necessary records, which would be faster and better from your point of view? I'm inexperienced and this is just an idea. And you can dissuade me if you think that this unnecessarily complicates or slows down the work (I understand that everything depends on the condition, but in general, in your opinion, which is better).
The idea is to make a selection of recommendations-i.e. search by 4 parameters, and recommendations are formed by the coincidence of three.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question