[TYPO3-dev] Discussion to Bugfix #7545: Explain select not working with multiple tables

Ingo Schmitt mailinglisten at i-schmitt.de
Wed Feb 20 19:08:21 CET 2008


Hi list,

this is a follow up discussion to my post on the Core List:

[TYPO3-core] RFC: Bugfix #7545: Explain select not working with multiple 
tables

Investigating into the issue, i figured out, that a from clause could 
not only be two tables joined directly, but also with inner and outer 
joins. This breaks my patch, posted on the Core List.

It seams that in this case: "SHOW INDEX FROM tt_news LEFT OUTER JOIN 
tt_news_cat_mm ON tt_news.uid = tt_news_cat_mm.uid_local" is the 
complete from clause on this sql statement. In this case we must detect 
every table in the from statement and extract it form the clause.
I don't see a way to archive this by an easy way, since we have to write 
a parser on the from clause to extract the Tables.

I personally have three ideas on how we could solve the problem:

1) Walk through the TCA tables definitions and check each table if it 
exists in the from clause and create a show index statement for the 
detected tables
+ Would detect almost all Tables defined in TCA
- Won't detect Tables not in TCA
- Reducing performance (but as in debug mode, I don't think this is a 
real issue).

2) Try to split the from clause by comma and spaces and than set
Debug SQL to Zero, issue the statment and set Debug SQL to the
default value.
+ Might detect also Tables not in TCA
0 SQL Statements with errors would be issued to Database, but not
shown
- Reducing performance (but as in debug mode, I don't think this is a 
real issue).

3) Only use this feature, if only one table is used, otherwise skip
the index output.


As I'm not sure, which solution could be the correct one, I like to 
start the discussion here to post a new patch to the core list.


Best regards

ingo

  Mit freundlichen Gruessen
-- 
Ingo Schmitt                        mailto:is at marketing-factory.de
Marketing Factory Consulting GmbH   http://typo3.marketing-factory.de/
Content Management mit Typo3: Beratung - Schulung - Realisierung




More information about the TYPO3-dev mailing list