Highly Simplified Example:
I have 2 tables in a one-to-many relationship. Table_A is the "one" side and has roughly 1000 rows of data. Table_B is the "many" side and has roughly 500 rows of data for each line in Table_A (aka approx 500k rows total).
SELECT Table_A.Column1, Table_A.Column2, Table_B.Column1
FROM Table_A INNER JOIN Table_B ON Table_A.ID = Table_B.ID
WHERE Table_A.ID = 345; (or, WHERE Table_B.ID = 345)
For some reason, my Database is selecting all 500k rows and THEN applying the WHERE clause to filter the results.
Is this how JOIN with WHERE clause is supposed to work? Join the tables completely and then include the records that meet the WHERE condition? Is it implementation specific? How can this query be optimized?
Note that in the problem I'm trying to solve, the WHERE clause is not always the same, it's usually a large collection of conditions. But I couldn't find any information on the net about the inner-workings of JOIN statements.
XI Wiki

