Re: [firebird-support] Need Speed Optimization for SQL

2015-04-16 Thread Vishal Tiwari vishuals...@yahoo.co.in [firebird-support]
Hi SET, I tried as below way by adding Group By clause: with TMP(PK_JOB_ITEMS) as (select distinct PK_JOB_ITEMS from CRM_JOB_ITEMS where FK_JOB = '{8BDDED49-8509-48C1-A169-B7E68A74C230}') select Sum(cdi.QUANTITY) AS Delivered, cdi.FK_JOB_ITEM from tmp t join CRM_DOCUMENT_ITEMS cdi on

RE: [firebird-support] Need Speed Optimization for SQL

2015-04-16 Thread Svein Erling Tysvær svein.erling.tysv...@kreftregisteret.no [firebird-support]
I have below SQL and DDL of respective columns used in this SQL. Below sql takes 6-7 seconds to give the result. Would it be possible to bring the output time to 1 seconds, coz there are some other operartion I need to perform based on this sql output withing short period of t ime. SQL:

Re: [firebird-support] Need Speed Optimization for SQL

2015-04-16 Thread Vishal Tiwari vishuals...@yahoo.co.in [firebird-support]
Hi SET, Nice to see you here, but I am getting below error after executing your sql, i think group by clause is needed, would you please help? Error: Invalid expression in the select list (not contained in either an aggregate function or the GROUP BY clause) On Thursday, 16 April 2015

RE: [firebird-support] Need Speed Optimization for SQL

2015-04-16 Thread Svein Erling Tysvær svein.erling.tysv...@kreftregisteret.no [firebird-support]
Hi SET, Nice to see you here, but I am getting below error after executing your sql, i think group by clause is needed, would you please help? Yes, sorry I forgot group by: with TMP(PK_JOB_ITEMS) as (select distinct PK_JOB_ITEMS from CRM_JOB_ITEMS where FK_JOB =

RE: [firebird-support] Need Speed Optimization for SQL

2015-04-16 Thread Svein Erling Tysvær svein.erling.tysv...@kreftregisteret.no [firebird-support]
Hi SET, I tried as below way by adding Group By clause: with TMP(PK_JOB_ITEMS) as (select distinct PK_JOB_ITEMS from CRM_JOB_ITEMS where FK_JOB = '{8BDDED49-8509-48C1-A169-B7E68A74C230}') select Sum(cdi.QUANTITY) AS Delivered, cdi.FK_JOB_ITEM from tmp t join CRM_DOCUMENT_ITEMS cdi on

Re: [firebird-support] Need Speed Optimization for SQL

2015-04-16 Thread Thomas Steinmaurer t...@iblogmanager.com [firebird-support]
Hi SET, I tried as below way by adding Group By clause: with TMP(PK_JOB_ITEMS) as (select distinct PK_JOB_ITEMS from CRM_JOB_ITEMS where FK_JOB = '{8BDDED49-8509-48C1-A169-B7E68A74C230}') select Sum(cdi.QUANTITY) AS Delivered, cdi.FK_JOB_ITEM from tmp t join CRM_DOCUMENT_ITEMS cdi on

Re: [firebird-support] Need Speed Optimization for SQL

2015-04-15 Thread Vishal Tiwari vishuals...@yahoo.co.in [firebird-support]
I tried with below SQL, but it is also taking 5 seconds, SELECT   Sum(CRM_DOCUMENT_ITEMS.QUANTITY) AS Delivered,   CRM_DOCUMENT_ITEMS.FK_JOB_ITEM FROM   CRM_DOCUMENT_ITEMS   INNER JOIN CRM_DOCUMENT_HEADER ON CRM_DOCUMENT_ITEMS.FK_DOCUMENT_HEADER = CRM_DOCUMENT_HEADER.PK_DOCUMENT_HEADER WHERE   

Re: [firebird-support] Need Speed Optimization for SQL

2015-04-15 Thread Robert martin r...@chreos.com [firebird-support]
Wow ! Do you have an index on CRM_JOB_ITEMS.PK_JOB_ITEMS ? On 16/04/2015 10:29 a.m., Vishal Tiwari vishuals...@yahoo.co.in [firebird-support] wrote: @Rob: Your SQL is taking 28 seconds... On Thursday, 16 April 2015 3:56 AM, Robert martin r...@chreos.com [firebird-support]

Re: [firebird-support] Need Speed Optimization for SQL

2015-04-15 Thread Robert martin r...@chreos.com [firebird-support]
Hi Try replacing your IN statement with an EXISTS clause. Something like CRM_DOCUMENT_HEADER.DOCUMENT_TYPE = 1 AND EXISTS(select PK_JOB_ITEMS from CRM_JOB_ITEMS where PK_JOB_ITEMS = CRM_DOCUMENT_ITEMS.FK_JOB_ITEM and FK_JOB = '{8BDDED49-8509-48C1-A169-B7E68A74C230}' ROWS 1) Cheers Rob On

[firebird-support] Need Speed Optimization for SQL

2015-04-15 Thread Vishal Tiwari vishuals...@yahoo.co.in [firebird-support]
Hi All, I have below SQL and DDL of respective columns used in this SQL. Below sql takes 6-7 seconds to give the result. Would it be possible to bring the output time to 1 seconds, coz there are some other operartion I need to perform based on this sql output withing short period of time. SQL:

Re: [firebird-support] Need Speed Optimization for SQL

2015-04-15 Thread Vishal Tiwari vishuals...@yahoo.co.in [firebird-support]
@Rob: Your SQL is taking 28 seconds... On Thursday, 16 April 2015 3:56 AM, Robert martin r...@chreos.com [firebird-support] firebird-support@yahoogroups.com wrote:   Hi Try replacing your IN statement with an EXISTS clause. Something like CRM_DOCUMENT_HEADER.DOCUMENT_TYPE = 1