Subject | Re: indices |
---|---|
Author | d_dude_2003 |
Post date | 2007-05-13T15:06:14Z |
here is the actual SQL
SELECT MOC_ITEMS.*,
PARTIES.NAME AS SENDERPARTY,
PARTYEMPLOYEES.NAME AS SENDERPERSON,
PARTIES_1.NAME AS RECIPIENTPARTY,
MOC_OFFICEEMPLOYEES_1.NAME AS RECIPIENTPERSON,
MOC_CATEGORIES.CATEGORY,
MOC_SUBCATEGORIES.SUBCATEGORY,
STATUSES.NAME AS STATUS,
PRIORITIES.NAME AS PRIORITY,
STATUSES_1.NAME AS ACCESSSTATUS,
MOC_ITEMCOMMENTS.COMMENTLINE,
MOC_COPIEDITEMS.USERID AS COPIEDUSERID
FROM ((STATUSES STATUSES_1 RIGHT JOIN
(((((PARTYEMPLOYEES MOC_OFFICEEMPLOYEES_1
RIGHT JOIN (PARTIES PARTIES_1
RIGHT JOIN (PARTYEMPLOYEES
RIGHT JOIN (PARTIES
RIGHT JOIN MOC_ITEMS ON PARTIES.PARTYID = MOC_ITEMS.SENDERPARTYID)
ON PARTYEMPLOYEES.OFFICEEMPLOYEEID = MOC_ITEMS.SENDERPERSONID)
ON PARTIES_1.PARTYID = MOC_ITEMS.RECIPIENTPARTYID)
ON MOC_OFFICEEMPLOYEES_1.OFFICEEMPLOYEEID =
MOC_ITEMS.RECIPIENTPERSONID)
LEFT JOIN MOC_CATEGORIES ON MOC_ITEMS.MOCCATEGORYID =
MOC_CATEGORIES.MOCCATEGORYID)
LEFT JOIN MOC_SUBCATEGORIES ON MOC_ITEMS.MOCSUBCATEGORYID =
MOC_SUBCATEGORIES.MOCSUBCATEGORYID)
LEFT JOIN STATUSES ON MOC_ITEMS.STATUSID = STATUSES.STATUSID)
LEFT JOIN PRIORITIES ON MOC_ITEMS.PRIORITYID = PRIORITIES.PRIORITYID)
ON STATUSES_1.STATUSID = MOC_ITEMS.ACCESSSTATUSID)
LEFT JOIN MOC_ITEMCOMMENTS ON MOC_ITEMS.MOCITEMID =
MOC_ITEMCOMMENTS.MOCITEMID)
LEFT JOIN MOC_COPIEDITEMS ON MOC_ITEMS.MOCITEMID = MOC_COPIEDITEMS.ID
WHERE (upper(PARTIES.NAME) = 'ADK')
When i run this in Database Workbench, i even cant go to Plan
Analysis, CPU usage gets to 100% on firebird process...
I understand that the query is not optimal. But it allows to search by
all the fields with varying WHERE statement...
Is there a way to improve the speed on large dataset?
Thanks.
--- In firebird-support@yahoogroups.com, "d_dude_2003"
<d_dude_2003@...> wrote:
SELECT MOC_ITEMS.*,
PARTIES.NAME AS SENDERPARTY,
PARTYEMPLOYEES.NAME AS SENDERPERSON,
PARTIES_1.NAME AS RECIPIENTPARTY,
MOC_OFFICEEMPLOYEES_1.NAME AS RECIPIENTPERSON,
MOC_CATEGORIES.CATEGORY,
MOC_SUBCATEGORIES.SUBCATEGORY,
STATUSES.NAME AS STATUS,
PRIORITIES.NAME AS PRIORITY,
STATUSES_1.NAME AS ACCESSSTATUS,
MOC_ITEMCOMMENTS.COMMENTLINE,
MOC_COPIEDITEMS.USERID AS COPIEDUSERID
FROM ((STATUSES STATUSES_1 RIGHT JOIN
(((((PARTYEMPLOYEES MOC_OFFICEEMPLOYEES_1
RIGHT JOIN (PARTIES PARTIES_1
RIGHT JOIN (PARTYEMPLOYEES
RIGHT JOIN (PARTIES
RIGHT JOIN MOC_ITEMS ON PARTIES.PARTYID = MOC_ITEMS.SENDERPARTYID)
ON PARTYEMPLOYEES.OFFICEEMPLOYEEID = MOC_ITEMS.SENDERPERSONID)
ON PARTIES_1.PARTYID = MOC_ITEMS.RECIPIENTPARTYID)
ON MOC_OFFICEEMPLOYEES_1.OFFICEEMPLOYEEID =
MOC_ITEMS.RECIPIENTPERSONID)
LEFT JOIN MOC_CATEGORIES ON MOC_ITEMS.MOCCATEGORYID =
MOC_CATEGORIES.MOCCATEGORYID)
LEFT JOIN MOC_SUBCATEGORIES ON MOC_ITEMS.MOCSUBCATEGORYID =
MOC_SUBCATEGORIES.MOCSUBCATEGORYID)
LEFT JOIN STATUSES ON MOC_ITEMS.STATUSID = STATUSES.STATUSID)
LEFT JOIN PRIORITIES ON MOC_ITEMS.PRIORITYID = PRIORITIES.PRIORITYID)
ON STATUSES_1.STATUSID = MOC_ITEMS.ACCESSSTATUSID)
LEFT JOIN MOC_ITEMCOMMENTS ON MOC_ITEMS.MOCITEMID =
MOC_ITEMCOMMENTS.MOCITEMID)
LEFT JOIN MOC_COPIEDITEMS ON MOC_ITEMS.MOCITEMID = MOC_COPIEDITEMS.ID
WHERE (upper(PARTIES.NAME) = 'ADK')
When i run this in Database Workbench, i even cant go to Plan
Analysis, CPU usage gets to 100% on firebird process...
I understand that the query is not optimal. But it allows to search by
all the fields with varying WHERE statement...
Is there a way to improve the speed on large dataset?
Thanks.
--- In firebird-support@yahoogroups.com, "d_dude_2003"
<d_dude_2003@...> wrote:
>