I've a db containing two tables which every item in table one is
linked to 1--200 items in table 2.
I want to generate a report like this:
Item in table 1
---------------------------------------
1st-related Item in table2
2nd related Item in table2
3rd related Item in table2
....
Nth related Item in table2
----------------------------------------
to do, I've generated a third table with a text-column to hold the
report text. Using an small procedure, I'v generated reports for all
items in table 1 and stored the text in the respective column.
Now, querying the third table take 100 times longer than joining
first and second tables.
the third table contains a single ID field which is a unique index.
the query for two table scenario and single table scenario are:
q1: select table2.* from table1 inner join table2 on table1.Id=
table2.Id where table2.id = <anid>
q2: select table3.* from table3 where Id = <anid>
Any Idea about the poor performance of the second query ?