Subject Re: Indexed used with search name='TEST' but not with name like 'TEST%'
Author swestner
Here they are:


The one with like:

SELECT IwadisObje_1.BOLD_ID, IwadisObje_1.BOLD_TYPE
FROM IwadisObject IwadisObje_1 JOIN Word Word_1 ON
(IwadisObje_1.BOLD_ID = Word_1.indexedObject)
WHERE ((Word_1.attribute = 'NAME') and (Word_1.data LIKE 'ANFRAGE%'))
AND (NOT(((SELECT COUNT(*)
FROM GlobalContext GlobalCont_1 JOIN IwadisObject IwadisObje_2 ON
(GlobalCont_1.BOLD_ID = IwadisObje_2.prototypeGlobalcontext)
WHERE IwadisObje_1.BOLD_ID = IwadisObje_2.BOLD_ID
) > 0)))
AND (IwadisObje_1.BOLD_TYPE IN (122))
AND (NOT(EXISTS (SELECT User__1.BOLD_ID
FROM User_ User__1 JOIN BannedObjects_User BannedObje_1 ON
(BannedObje_1.bannedUsers = User__1.BOLD_ID), Document Document_1,
BusinessClassesRoot BusinessCl_1
WHERE IwadisObje_1.BOLD_ID = Document_1.BOLD_ID
AND BannedObje_1.bannedObjects = Document_1.BOLD_ID
AND User__1.BOLD_ID = BusinessCl_1.BOLD_ID
AND (BusinessCl_1.iwadisID = '50C3B73C-095B-439C-BFAF-1BE6EC0BBD2E')
)))
AND (NOT((EXISTS (SELECT User__2.BOLD_ID
FROM User_ User__2 JOIN IwadisObject IwadisObje_3 ON (User__2.BOLD_ID
= IwadisObje_3.privateUser)
WHERE IwadisObje_1.BOLD_ID = IwadisObje_3.BOLD_ID
) and EXISTS (SELECT User__3.BOLD_ID
FROM User_ User__3 JOIN IwadisObject IwadisObje_4 ON (User__3.BOLD_ID
= IwadisObje_4.privateUser) JOIN BusinessClassesRoot BusinessCl_2 ON
(User__3.BOLD_ID = BusinessCl_2.BOLD_ID)
WHERE IwadisObje_1.BOLD_ID = IwadisObje_4.BOLD_ID
AND (BusinessCl_2.iwadisID <> '50C3B73C-095B-439C-BFAF-1BE6EC0BBD2E')
))))
AND (not(((IwadisObje_1.visibility <> 2) and (not(EXISTS (SELECT
Client_1.BOLD_ID
FROM Client Client_1 JOIN IwadisObject IwadisObje_5 ON
(Client_1.BOLD_ID = IwadisObje_5.creatorClient) JOIN
BusinessClassesRoot BusinessCl_3 ON (Client_1.BOLD_ID =
BusinessCl_3.BOLD_ID)
WHERE IwadisObje_1.BOLD_ID = IwadisObje_5.BOLD_ID
AND ((((((((BusinessCl_3.iwadisID = 'C065B968-4F39-4DF0-90C9-
6FDF7B91328E') or (BusinessCl_3.iwadisID = '177BADBB-3FF1-40FE-AD05-
3A41410F969F')) or (BusinessCl_3.iwadisID = 'DD76699F-CAA3-48E4-953C-
B79FBF05401A')) or (BusinessCl_3.iwadisID = '38D902DB-C62D-4F12-A77E-
F72EDDEF1092')) or (BusinessCl_3.iwadisID = 'AE0353BF-D7F0-4710-982B-
B8110FC21103')) or (BusinessCl_3.iwadisID = '5F4809FC-FB16-48AF-A4FA-
E49BF5DD728E')) or (BusinessCl_3.iwadisID = '12B9E4FE-0D5D-4C5D-82FB-
A02CF566E06C')) or (BusinessCl_3.iwadisID = 'A4492F9C-7991-406E-8A1C-
D08F1779F2B9'))
))))))
AND (NOT(EXISTS (SELECT User__4.BOLD_ID
FROM User_ User__4 JOIN BannedObjects_User BannedObje_2 ON
(BannedObje_2.bannedUsers = User__4.BOLD_ID), Document Document_2,
BusinessClassesRoot BusinessCl_4
WHERE IwadisObje_1.BOLD_ID = Document_2.BOLD_ID
AND BannedObje_2.bannedObjects = Document_2.BOLD_ID
AND User__4.BOLD_ID = BusinessCl_4.BOLD_ID
AND (BusinessCl_4.iwadisID = '50C3B73C-095B-439C-BFAF-1BE6EC0BBD2E')
)))
AND (NOT((EXISTS (SELECT User__5.BOLD_ID
FROM User_ User__5 JOIN IwadisObject IwadisObje_6 ON (User__5.BOLD_ID
= IwadisObje_6.privateUser)
WHERE IwadisObje_1.BOLD_ID = IwadisObje_6.BOLD_ID
) and EXISTS (SELECT User__6.BOLD_ID
FROM User_ User__6 JOIN IwadisObject IwadisObje_7 ON (User__6.BOLD_ID
= IwadisObje_7.privateUser) JOIN BusinessClassesRoot BusinessCl_5 ON
(User__6.BOLD_ID = BusinessCl_5.BOLD_ID)
WHERE IwadisObje_1.BOLD_ID = IwadisObje_7.BOLD_ID
AND (BusinessCl_5.iwadisID <> '50C3B73C-095B-439C-BFAF-1BE6EC0BBD2E')
))))
AND (not((((IwadisObje_1.visibility = 0) and (not(EXISTS (SELECT
Role__1.BOLD_ID
FROM Role_ Role__1 JOIN RoleObjectsHolder RoleObject_1 ON
(Role__1.BOLD_ID = RoleObject_1.role_), IwadisObject IwadisObje_8,
BusinessClassesRoot BusinessCl_6
WHERE IwadisObje_1.BOLD_ID = IwadisObje_8.BOLD_ID
AND RoleObject_1.BOLD_ID = IwadisObje_8.holder
AND Role__1.BOLD_ID = BusinessCl_6.BOLD_ID
AND (((((((((((((((((BusinessCl_6.iwadisID = '8490C0F7-3875-4A68-
87DE-4348C64CE165') or (BusinessCl_6.iwadisID = '86572637-B66C-4D42-
96EF-0C2CDED7B936')) or (BusinessCl_6.iwadisID = '8894B673-F1A5-4451-
8D40-E0745AF96293')) or (BusinessCl_6.iwadisID = '1CF315E4-1E70-42E9-
ACD9-167AB851CCC4')) or (BusinessCl_6.iwadisID = '70A4A04D-BC0C-4DAD-
8974-81DA0A8C516D')) or (BusinessCl_6.iwadisID = 'E59072FC-42A5-458C-
B411-F13DC262628C')) or (BusinessCl_6.iwadisID = 'E2BBB71C-24D7-41F6-
88BD-83E8ADED57D0')) or (BusinessCl_6.iwadisID = '9EB72E34-AE74-4798-
A343-61AF601F2B60')) or (BusinessCl_6.iwadisID = 'B6EC3292-7DD9-49C3-
B7E4-090E6E8FFEF1')) or (BusinessCl_6.iwadisID = '928860C6-BF8D-4DC7-
AA66-D3639ECD053D')) or (BusinessCl_6.iwadisID = 'DF10B4FD-79F3-4383-
B1AC-263432A75470')) or (BusinessCl_6.iwadisID = 'C7F1B5C0-19BC-404B-
98D3-F00D4A2A14FA')) or (BusinessCl_6.iwadisID = '67C4D4A8-1B52-4944-
902E-53C50AC7FFFB')) or (BusinessCl_6.iwadisID = '47611791-5DFC-4AD3-
8726-EBB66BBE627A')) or (BusinessCl_6.iwadisID = '53F48F27-0D2E-44FB-
AA83-37FE0FC3574A')) or (BusinessCl_6.iwadisID = '11FF6C31-800B-4D6B-
BFEC-F0E9C38BE9E4')) or (BusinessCl_6.iwadisID
= 'CA02291F6EA64046B46FA6FE4B4B40C9'))
)))) and (not(EXISTS (SELECT Role__2.BOLD_ID
FROM Role_ Role__2 JOIN IwadisObject_Role IwadisObje_9 ON
(IwadisObje_9.coworkerRoles = Role__2.BOLD_ID), Document Document_3,
BusinessClassesRoot BusinessCl_7
WHERE IwadisObje_1.BOLD_ID = Document_3.BOLD_ID
AND IwadisObje_9.coworkerObjects = Document_3.BOLD_ID
AND Role__2.BOLD_ID = BusinessCl_7.BOLD_ID
AND (((((((((((((((((BusinessCl_7.iwadisID = '8490C0F7-3875-4A68-
87DE-4348C64CE165') or (BusinessCl_7.iwadisID = '86572637-B66C-4D42-
96EF-0C2CDED7B936')) or (BusinessCl_7.iwadisID = '8894B673-F1A5-4451-
8D40-E0745AF96293')) or (BusinessCl_7.iwadisID = '1CF315E4-1E70-42E9-
ACD9-167AB851CCC4')) or (BusinessCl_7.iwadisID = '70A4A04D-BC0C-4DAD-
8974-81DA0A8C516D')) or (BusinessCl_7.iwadisID = 'E59072FC-42A5-458C-
B411-F13DC262628C')) or (BusinessCl_7.iwadisID = 'E2BBB71C-24D7-41F6-
88BD-83E8ADED57D0')) or (BusinessCl_7.iwadisID = '9EB72E34-AE74-4798-
A343-61AF601F2B60')) or (BusinessCl_7.iwadisID = 'B6EC3292-7DD9-49C3-
B7E4-090E6E8FFEF1')) or (BusinessCl_7.iwadisID = '928860C6-BF8D-4DC7-
AA66-D3639ECD053D')) or (BusinessCl_7.iwadisID = 'DF10B4FD-79F3-4383-
B1AC-263432A75470')) or (BusinessCl_7.iwadisID = 'C7F1B5C0-19BC-404B-
98D3-F00D4A2A14FA')) or (BusinessCl_7.iwadisID = '67C4D4A8-1B52-4944-
902E-53C50AC7FFFB')) or (BusinessCl_7.iwadisID = '47611791-5DFC-4AD3-
8726-EBB66BBE627A')) or (BusinessCl_7.iwadisID = '53F48F27-0D2E-44FB-
AA83-37FE0FC3574A')) or (BusinessCl_7.iwadisID = '11FF6C31-800B-4D6B-
BFEC-F0E9C38BE9E4')) or (BusinessCl_7.iwadisID
= 'CA02291F6EA64046B46FA6FE4B4B40C9'))
))))))




The one with =:
SELECT IwadisObje_1.BOLD_ID, IwadisObje_1.BOLD_TYPE
FROM IwadisObject IwadisObje_1 JOIN Word Word_1 ON
(IwadisObje_1.BOLD_ID = Word_1.indexedObject)
WHERE ((Word_1.attribute = 'NAME') and (Word_1.data = 'ANFRAGE'))
AND (NOT(((SELECT COUNT(*)
FROM GlobalContext GlobalCont_1 JOIN IwadisObject IwadisObje_2 ON
(GlobalCont_1.BOLD_ID = IwadisObje_2.prototypeGlobalcontext)
WHERE IwadisObje_1.BOLD_ID = IwadisObje_2.BOLD_ID
) > 0)))
AND (IwadisObje_1.BOLD_TYPE IN (122))
AND (NOT(EXISTS (SELECT User__1.BOLD_ID
FROM User_ User__1 JOIN BannedObjects_User BannedObje_1 ON
(BannedObje_1.bannedUsers = User__1.BOLD_ID), Document Document_1,
BusinessClassesRoot BusinessCl_1
WHERE IwadisObje_1.BOLD_ID = Document_1.BOLD_ID
AND BannedObje_1.bannedObjects = Document_1.BOLD_ID
AND User__1.BOLD_ID = BusinessCl_1.BOLD_ID
AND (BusinessCl_1.iwadisID = '50C3B73C-095B-439C-BFAF-1BE6EC0BBD2E')
)))
AND (NOT((EXISTS (SELECT User__2.BOLD_ID
FROM User_ User__2 JOIN IwadisObject IwadisObje_3 ON (User__2.BOLD_ID
= IwadisObje_3.privateUser)
WHERE IwadisObje_1.BOLD_ID = IwadisObje_3.BOLD_ID
) and EXISTS (SELECT User__3.BOLD_ID
FROM User_ User__3 JOIN IwadisObject IwadisObje_4 ON (User__3.BOLD_ID
= IwadisObje_4.privateUser) JOIN BusinessClassesRoot BusinessCl_2 ON
(User__3.BOLD_ID = BusinessCl_2.BOLD_ID)
WHERE IwadisObje_1.BOLD_ID = IwadisObje_4.BOLD_ID
AND (BusinessCl_2.iwadisID <> '50C3B73C-095B-439C-BFAF-1BE6EC0BBD2E')
))))
AND (not(((IwadisObje_1.visibility <> 2) and (not(EXISTS (SELECT
Client_1.BOLD_ID
FROM Client Client_1 JOIN IwadisObject IwadisObje_5 ON
(Client_1.BOLD_ID = IwadisObje_5.creatorClient) JOIN
BusinessClassesRoot BusinessCl_3 ON (Client_1.BOLD_ID =
BusinessCl_3.BOLD_ID)
WHERE IwadisObje_1.BOLD_ID = IwadisObje_5.BOLD_ID
AND ((((((((BusinessCl_3.iwadisID = 'C065B968-4F39-4DF0-90C9-
6FDF7B91328E') or (BusinessCl_3.iwadisID = '177BADBB-3FF1-40FE-AD05-
3A41410F969F')) or (BusinessCl_3.iwadisID = 'DD76699F-CAA3-48E4-953C-
B79FBF05401A')) or (BusinessCl_3.iwadisID = '38D902DB-C62D-4F12-A77E-
F72EDDEF1092')) or (BusinessCl_3.iwadisID = 'AE0353BF-D7F0-4710-982B-
B8110FC21103')) or (BusinessCl_3.iwadisID = '5F4809FC-FB16-48AF-A4FA-
E49BF5DD728E')) or (BusinessCl_3.iwadisID = '12B9E4FE-0D5D-4C5D-82FB-
A02CF566E06C')) or (BusinessCl_3.iwadisID = 'A4492F9C-7991-406E-8A1C-
D08F1779F2B9'))
))))))
AND (NOT(EXISTS (SELECT User__4.BOLD_ID
FROM User_ User__4 JOIN BannedObjects_User BannedObje_2 ON
(BannedObje_2.bannedUsers = User__4.BOLD_ID), Document Document_2,
BusinessClassesRoot BusinessCl_4
WHERE IwadisObje_1.BOLD_ID = Document_2.BOLD_ID
AND BannedObje_2.bannedObjects = Document_2.BOLD_ID
AND User__4.BOLD_ID = BusinessCl_4.BOLD_ID
AND (BusinessCl_4.iwadisID = '50C3B73C-095B-439C-BFAF-1BE6EC0BBD2E')
)))
AND (NOT((EXISTS (SELECT User__5.BOLD_ID
FROM User_ User__5 JOIN IwadisObject IwadisObje_6 ON (User__5.BOLD_ID
= IwadisObje_6.privateUser)
WHERE IwadisObje_1.BOLD_ID = IwadisObje_6.BOLD_ID
) and EXISTS (SELECT User__6.BOLD_ID
FROM User_ User__6 JOIN IwadisObject IwadisObje_7 ON (User__6.BOLD_ID
= IwadisObje_7.privateUser) JOIN BusinessClassesRoot BusinessCl_5 ON
(User__6.BOLD_ID = BusinessCl_5.BOLD_ID)
WHERE IwadisObje_1.BOLD_ID = IwadisObje_7.BOLD_ID
AND (BusinessCl_5.iwadisID <> '50C3B73C-095B-439C-BFAF-1BE6EC0BBD2E')
))))
AND (not((((IwadisObje_1.visibility = 0) and (not(EXISTS (SELECT
Role__1.BOLD_ID
FROM Role_ Role__1 JOIN RoleObjectsHolder RoleObject_1 ON
(Role__1.BOLD_ID = RoleObject_1.role_), IwadisObject IwadisObje_8,
BusinessClassesRoot BusinessCl_6
WHERE IwadisObje_1.BOLD_ID = IwadisObje_8.BOLD_ID
AND RoleObject_1.BOLD_ID = IwadisObje_8.holder
AND Role__1.BOLD_ID = BusinessCl_6.BOLD_ID
AND (((((((((((((((((BusinessCl_6.iwadisID = '8490C0F7-3875-4A68-
87DE-4348C64CE165') or (BusinessCl_6.iwadisID = '86572637-B66C-4D42-
96EF-0C2CDED7B936')) or (BusinessCl_6.iwadisID = '8894B673-F1A5-4451-
8D40-E0745AF96293')) or (BusinessCl_6.iwadisID = '1CF315E4-1E70-42E9-
ACD9-167AB851CCC4')) or (BusinessCl_6.iwadisID = '70A4A04D-BC0C-4DAD-
8974-81DA0A8C516D')) or (BusinessCl_6.iwadisID = 'E59072FC-42A5-458C-
B411-F13DC262628C')) or (BusinessCl_6.iwadisID = 'E2BBB71C-24D7-41F6-
88BD-83E8ADED57D0')) or (BusinessCl_6.iwadisID = '9EB72E34-AE74-4798-
A343-61AF601F2B60')) or (BusinessCl_6.iwadisID = 'B6EC3292-7DD9-49C3-
B7E4-090E6E8FFEF1')) or (BusinessCl_6.iwadisID = '928860C6-BF8D-4DC7-
AA66-D3639ECD053D')) or (BusinessCl_6.iwadisID = 'DF10B4FD-79F3-4383-
B1AC-263432A75470')) or (BusinessCl_6.iwadisID = 'C7F1B5C0-19BC-404B-
98D3-F00D4A2A14FA')) or (BusinessCl_6.iwadisID = '67C4D4A8-1B52-4944-
902E-53C50AC7FFFB')) or (BusinessCl_6.iwadisID = '47611791-5DFC-4AD3-
8726-EBB66BBE627A')) or (BusinessCl_6.iwadisID = '53F48F27-0D2E-44FB-
AA83-37FE0FC3574A')) or (BusinessCl_6.iwadisID = '11FF6C31-800B-4D6B-
BFEC-F0E9C38BE9E4')) or (BusinessCl_6.iwadisID
= 'CA02291F6EA64046B46FA6FE4B4B40C9'))
)))) and (not(EXISTS (SELECT Role__2.BOLD_ID
FROM Role_ Role__2 JOIN IwadisObject_Role IwadisObje_9 ON
(IwadisObje_9.coworkerRoles = Role__2.BOLD_ID), Document Document_3,
BusinessClassesRoot BusinessCl_7
WHERE IwadisObje_1.BOLD_ID = Document_3.BOLD_ID
AND IwadisObje_9.coworkerObjects = Document_3.BOLD_ID
AND Role__2.BOLD_ID = BusinessCl_7.BOLD_ID
AND (((((((((((((((((BusinessCl_7.iwadisID = '8490C0F7-3875-4A68-
87DE-4348C64CE165') or (BusinessCl_7.iwadisID = '86572637-B66C-4D42-
96EF-0C2CDED7B936')) or (BusinessCl_7.iwadisID = '8894B673-F1A5-4451-
8D40-E0745AF96293')) or (BusinessCl_7.iwadisID = '1CF315E4-1E70-42E9-
ACD9-167AB851CCC4')) or (BusinessCl_7.iwadisID = '70A4A04D-BC0C-4DAD-
8974-81DA0A8C516D')) or (BusinessCl_7.iwadisID = 'E59072FC-42A5-458C-
B411-F13DC262628C')) or (BusinessCl_7.iwadisID = 'E2BBB71C-24D7-41F6-
88BD-83E8ADED57D0')) or (BusinessCl_7.iwadisID = '9EB72E34-AE74-4798-
A343-61AF601F2B60')) or (BusinessCl_7.iwadisID = 'B6EC3292-7DD9-49C3-
B7E4-090E6E8FFEF1')) or (BusinessCl_7.iwadisID = '928860C6-BF8D-4DC7-
AA66-D3639ECD053D')) or (BusinessCl_7.iwadisID = 'DF10B4FD-79F3-4383-
B1AC-263432A75470')) or (BusinessCl_7.iwadisID = 'C7F1B5C0-19BC-404B-
98D3-F00D4A2A14FA')) or (BusinessCl_7.iwadisID = '67C4D4A8-1B52-4944-
902E-53C50AC7FFFB')) or (BusinessCl_7.iwadisID = '47611791-5DFC-4AD3-
8726-EBB66BBE627A')) or (BusinessCl_7.iwadisID = '53F48F27-0D2E-44FB-
AA83-37FE0FC3574A')) or (BusinessCl_7.iwadisID = '11FF6C31-800B-4D6B-
BFEC-F0E9C38BE9E4')) or (BusinessCl_7.iwadisID
= 'CA02291F6EA64046B46FA6FE4B4B40C9'))
))))))



Please note that I cannot modify the SQL becuase they are generated
automated from OCL from Bold for Delphi....

Stefan

--- In firebird-support@yahoogroups.com, "Leyne, Sean" <Sean@...>
wrote:
>
> Stefan,
>
> > Again you could download a database with the two queries at
> > http://www.iwadis.de/upload/FirebirdUsenetPosting.rar
>
> Please post the SQL for the queries
>
>
> Sean
>