Hallo,
i have the following situation:
Table1:
id - primary
name - varchar
Table2:
id - primary
Table1_id - foreign of Table1
Table3_id - foreign of Table3
Table3:
id - primary
name - varchar
The problem:
I wanna select all rows from Table1 which have lets say 3 entrys in Table 3. Those 3 entrys should also be selected with a WHERE, means there could be 10, but i just wanna have all rows from Table1 which have 3 specific entrys in Table3
my current solution is to select all entrys from Table3 since i know the values and join to up to Table1. Afterwards i filter the result out in [insert any programming language here] (in my case Python) )
But this relation does have atm around 140.000 entrys and its taking over 1.5 secs to select + the time python needs to loop over all results an delete all not needed stuff. And the big problem is the overhead of entrys im not needing.
Mostly im getting result sets with like 3000+ results, after the filtering there is maybe 1/6 left.
Thats just a part of a whole query, the original query joins over 5 Tables to get all infos we need, but i guess thats just overhead for the problem here ...
I wanna have all Results from Table1 which have X specific entrys in Table3
i really hope there is a nice solution or just ideas, anything would help
Goir
i have the following situation:
Table1:
id - primary
name - varchar
Table2:
id - primary
Table1_id - foreign of Table1
Table3_id - foreign of Table3
Table3:
id - primary
name - varchar
The problem:
I wanna select all rows from Table1 which have lets say 3 entrys in Table 3. Those 3 entrys should also be selected with a WHERE, means there could be 10, but i just wanna have all rows from Table1 which have 3 specific entrys in Table3
my current solution is to select all entrys from Table3 since i know the values and join to up to Table1. Afterwards i filter the result out in [insert any programming language here] (in my case Python) )
But this relation does have atm around 140.000 entrys and its taking over 1.5 secs to select + the time python needs to loop over all results an delete all not needed stuff. And the big problem is the overhead of entrys im not needing.
Mostly im getting result sets with like 3000+ results, after the filtering there is maybe 1/6 left.
Thats just a part of a whole query, the original query joins over 5 Tables to get all infos we need, but i guess thats just overhead for the problem here ...
I wanna have all Results from Table1 which have X specific entrys in Table3
i really hope there is a nice solution or just ideas, anything would help
Goir
Comment