# HG changeset patch # User Alain Mazy # Date 1740051594 -3600 # Node ID 3657d84703b95f8999a0f2d9585bd6dc4562b6f4 # Parent 77004b16d7fe8e8a66a3653139428ca92e42743d opti: left join vs full join diff -r 77004b16d7fe -r 3657d84703b9 Framework/Plugins/ISqlLookupFormatter.cpp --- a/Framework/Plugins/ISqlLookupFormatter.cpp Thu Feb 20 11:54:14 2025 +0100 +++ b/Framework/Plugins/ISqlLookupFormatter.cpp Thu Feb 20 12:39:54 2025 +0100 @@ -440,26 +440,26 @@ if (tagLevel == requestLevel) { - target = " FULL JOIN " + tagTable + " " + orderArg + " ON " + orderArg + ".id = " + FormatLevel(requestLevel) + + target = " LEFT JOIN " + tagTable + " " + orderArg + " ON " + orderArg + ".id = " + FormatLevel(requestLevel) + ".internalId AND " + tagFilter; } else if (static_cast(requestLevel) - static_cast(tagLevel) == 1) { target = " INNER JOIN Resources " + orderArg + "parent ON " + orderArg + "parent.internalId = " + FormatLevel(requestLevel) + ".parentId " - " FULL JOIN " + tagTable + " " + orderArg + " ON " + orderArg + ".id = " + orderArg + "parent.internalId AND " + tagFilter; + " LEFT JOIN " + tagTable + " " + orderArg + " ON " + orderArg + ".id = " + orderArg + "parent.internalId AND " + tagFilter; } else if (static_cast(requestLevel) - static_cast(tagLevel) == 2) { target = " INNER JOIN Resources " + orderArg + "parent ON " + orderArg + "parent.internalId = " + FormatLevel(requestLevel) + ".parentId " " INNER JOIN Resources " + orderArg + "grandparent ON " + orderArg + "grandparent.internalId = " + orderArg + "parent.parentId " - " FULL JOIN " + tagTable + " " + orderArg + " ON " + orderArg + ".id = " + orderArg + "grandparent.internalId AND " + tagFilter; + " LEFT JOIN " + tagTable + " " + orderArg + " ON " + orderArg + ".id = " + orderArg + "grandparent.internalId AND " + tagFilter; } else if (static_cast(requestLevel) - static_cast(tagLevel) == 3) { target = " INNER JOIN Resources " + orderArg + "parent ON " + orderArg + "parent.internalId = " + FormatLevel(requestLevel) + ".parentId " " INNER JOIN Resources " + orderArg + "grandparent ON " + orderArg + "grandparent.internalId = " + orderArg + "parent.parentId " " INNER JOIN Resources " + orderArg + "grandgrandparent ON " + orderArg + "grandgrandparent.internalId = " + orderArg + "grandparent.parentId " - " FULL JOIN " + tagTable + " " + orderArg + " ON " + orderArg + ".id = " + orderArg + "grandgrandparent.internalId AND " + tagFilter; + " LEFT JOIN " + tagTable + " " + orderArg + " ON " + orderArg + ".id = " + orderArg + "grandgrandparent.internalId AND " + tagFilter; } } #endif @@ -473,7 +473,7 @@ { std::string arg = "order" + boost::lexical_cast(index); - target = " FULL JOIN Metadata " + arg + " ON " + arg + ".id = " + FormatLevel(requestLevel) + + target = " LEFT JOIN Metadata " + arg + " ON " + arg + ".id = " + FormatLevel(requestLevel) + ".internalId AND " + arg + ".type = " + boost::lexical_cast(metadata); }