Query takes very very long time to display on the web portal.

HI Gurus
My query takes very very long time to display the result on the web.It takes almost 30 mins to show the
results.However when I execute the same query in analyzer it shows the result in 10 Sec.
Gurus could u please let me what r the steps required to increase teh performance of it.
What steps BI Consultant take to resolve it . Is it a portal issue.
Regards
loyee

Hi,
you can use the following parameters to the start URL: &PROFILING=X&TRACE=X. They could be set in iView of Portal as well as the url of the webtemplate. You will get information about performance of the web application.
Additional check this notes:
NW 7.0 BI Web Applications: Performance Problem Analysis
SAP Note Number: [1048691|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes/sdn_oss_bw_bex/~form/handler]
Performance problems when you start a query in Java Web
SAP Note Number: [950602|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes/sdn_oss_bw_bex/~form/handler]
Also intresting threads:
Re: Poor performance Web vs Bex
Re: BEx vs the Web : Which provides better performance
Regards
Andreas

Similar Messages

  • My debit card kept getting rejected by my iTunes account, it there an issue with iTunes? I have been using the same Card since very long time. I downloaded the iOS 8, can I talk to someone so I can get this resolve?

    My debit card kept getting rejected by my iTunes account, it there an issue with iTunes? I have been using the same Card since very long time. I downloaded the iOS 8, can I talk to someone so I can get this resolve?

    Apple is not here. Contact Apple to resolve your issue:
    iTunes Support WorldWide
    or
    iTunes Support by eMail ww
    Cheers,
    GB

  • Taking long time in displaying the messages in SXMB_MONI

    Dear All,
    When I go to SXMB_MONI to display messages, it takes very long time in displaying the messgaes.
    And when i double clicks on any message to see its details then also it takes very long in opening the details. During this period server also becomes so much slow that it becomes very difficult to even open any other screen on the server and it looks as server has got hanged up. But after a long wait once the messages are displayed in SXMB_MONI then the server behaves normally.
    Kindly suggest what might be the error.
    Regards,
    NJ

    Hi,
    Please check in tcode SM50, if there are any archiving, deletion jobs are scheduled or check in SXMB_ADMIN-->Persistence layer analysis if the level is too high, schedule the switch delete procedure.Also check in ST06 what is the Utilization %.
    Thanks!

  • App-V 5 Full Infrastructure Apps take long time to stream to the client

    Hi was wondering if anyone has the same issue as i am or knows a fix for this, below is my problem and the troubleshooting i have done.
    Overview of problem
    App-V 5 apps delivered via App-V 5 full infrastructure take a long time to stream to the client and this means the user has to wait if they try and run an application before it has streamed to the client. Users sometimes have to
    wait 2 or 3 minutes for an application to stream and this is about 40 times slower than basic SMB and HTTP transfer tests show the system is capable of (see performance results below).
    App-V 4.6 apps delivered via App-V 4.6 full infrastructure and HTTP streaming are fine.
    Overview of environment
    App-V 5.0 SP1 Full Infrastructure.
    App-V servers are running Server 2012 on Hyper-V 3 or ESX 5.1 with 2 x vCPU and 4GB RAM.
    SQL servers are a SQL 2012 cluster.
    Separate servers for SQL, management, publishing, content and reporting.
    Management, Publishing and Content servers have two servers per role and NLB to provide load balancing. So 7 servers (2 x Man, 2 x Pub, 2 x Content, 1 x Reporting)
    Two further sites with 2 x Pub and 2 x Content each. All publishing servers pointed at the load balance address for management.
    Content delivered via HTTP
    Clients are physical desktops and laptops running Windows 7 SP1 x86 and Windows 8 x86
    App-V client is 5.0SP1
    Clients are pointed at their nearest publishing server NLB via a script which looks up the client IP address and uses PowerShell to configure the publishing server
    Content is streamed from the nearest content server NLB by setting the PackageSourceRoot to the nearest content NLB (via the same PowerShell script above).
    App-V apps delivered per-user via AD group. One AD group per application. Approximately 200 App-V apps published so far - will eventually reach 400 as we sequence more. About 9000 users.
    Analysis performed so far
    Servers not heavily loaded. CPU averages 5%. Lots of RAM free. Very low disk IO. Problem also occurs out-of-hours so we are 99.9% certain that server resources are not a cause.
    Streaming performance is the same from all 6 content servers and all 3 NLB addresses (tested by changing the value of PackageSourceRoot). Wireshark used to confirm packages are really streaming from the correct location, enforcing
    our belief that the problem isn't at the server end (unless all 6 servers are affected).
    Streaming via both HTTP and SMB2.1 is approximately the same (tested by changing the value of PackageSourceRoot between http://xxxx and \\server\AppVContent).
    Wireshark used to confirm we really are using the protocol we think we are using.
    All clients exhibit the same behaviour. Issue reported by many users. 5 test PCs chosen at random at all 3 sites confirmed to have the slow streaming problem.
    Slow streaming from both Hyper-V and VMware ESX servers.
    Client not heavily loaded.
    Affects all App-V apps although it obviously affects the larger ones more.
    All App-V apps have a Feature Block 1 setup.
    If we copy the ".appv" file from the server to the client via either HTTP or SMB then it's reasonably quick (up to 480Mb/s). So we don't believe the network or servers are at fault. For example:
    We can copy a 149MB .appv file via SMB from the content server to the client in 5 seconds.
    We copy HTTP download the .appv file from the content server using IE on the client in 5 seconds.
    But if you ask the App-V 5 client to fully download the sequence then it takes 2 - 3 minutes.
    The App-V 4.6 client takes about 8 - 10 seconds to fully download a similar sized application.
    App-V 5 publishing works fine - when a new user logs on they get their list of application straight away, it's just the streaming which is slow.
    Once the App-V app has streamed locally it runs fine and with a decent performance.
    Looking at a Wireshark trace of the streaming you can see that the slow performance is due to the transfer stopping and starting a lot. You only notice this when you zoom into the performance graph a fair bit.
    Each time the HTTP server stops sending traffic, it doesn't start again until the client sends a "TCP Window update". Each "stop" is of a different length, but just taking a few from the middle I get 0.06s, 0.11s,
    0.13s wasted etc.
    I can see that it's the client stopping the transfer by reducing its advertised TCP Window Size. I'll provide an example:
    Server sends 9 x 1514 bytes. Client responds with an ACK and a Window size of 54016 bytes (256x211)
    Server sends 11 x 1514 bytes. Client responds with an ACK and a Window size of 37888 bytes (256x148)
    Server sends 10 x 1514 bytes. Client responds with an ACK and a Window size of 23296 bytes (256x91)
    Server sends 15 x 1514 bytes. Client responds with an ACK and a Window size of 1280 bytes (5 x 256)
    Server stops sending (I'm guessing because the client advertised Window size was less than a single packet's worth of bytes)
    <0.1 seconds passes>
    Client sends a "TCP Window Update" re-advertising a TCP window size of 65536 (256x256).
    Server starts transmitting again
    So the way I see this is that the App-V 5 client is controlling the transfer speed by utilising TCP Window flow control. The trace was taken at the client end so there's no room for anything on the network to be fiddling with flow
    control (and we've confirmed there are no traffic shapers in the loop).
    We've also tried streaming directly from the local client by copying some App-V 5 apps down to the client, creating a SMB share on the client and changing PackageSourceRoot to \\localhost\AppVContent (i.e. so we are streaming directly
    from the client to the client - to remove the network from the equation) and there is only an improvement of 5 to 10 seconds. So we know it's nothing to do with the network or the servers.
    We've tried turning off TCP auto-tuning on the client with:
    netsh interface tcp set global autotuninglevel=disabled
    and turning off TCP chimney offloading (which is off anyway because the NIC doesn't support it and Netstat -t output shows "InHost" for offload state for all connections) with:
    netsh int tcp set global chimney=disabled
    and nothing has improved.
    So we've now focussed on the extraction of the .appv (ZIP) file on the client.
    Using Windows Explorer it takes 75 seconds to extract the ZIP file
    Using 7ZIP it takes 9 seconds to extract the ZIP file
    Yeah we've always known that the Explorer ZIP engine is terrible. That's why we use 7ZIP or WinRAR on our clients.
    So we've started to wonder if the problem with the slow App-V 5 streaming is because the client is downloading the .appv file and extracting it as it goes along in a single thread. If the App-V 5 client is using the same terrible
    ZIP engine that Explorer does then that would explain the slow performance. The "download" appears to take a long time because the client is using TCP flow control to slow the transfer since it's extracting the .appv file using a very slow ZIP engine
    and it's all in a single thread.

    Guys,
    Just wanted to give you a brief update basically close this thread as Answered.
    We had submitted 4 App-V 5 Bugs to Microsoft and these were reproducible and an explanation was given on work around to them. Microsoft
    sent down a App-v developer to have a look at our problems. They said they will try and include the Bug fixes in SP2 which should be out in a few weeks or they will definitely be included in SP3.
    In regards to the slow streaming it all came down to the Disk IO.
    We found that you could simply enable "Turn off
    Windows write-cache buffer flushing on the device", then start streaming the app and then disable "Turn
    off Windows write-cache buffer flushing on the device" immediately after
    (we don't want to leave it on) and that basically fixed the issue.
    But a normal user would not have permissions to do
    this, so a code was written to enable and disable this option.
    Apology for not going in detail, like my opening thread, its very late. 
    but if you would like a detailed analysis please message me.
    I would like to Thank the Talented Consultant who designed and implemented are App-V infrastructure who found the bugs and created all
    the work around and who also emailed the detailed analysis of the problems to Microsoft that got them interested.
    Simon Bond from Ultima Business Solutions.
    Thank you

  • Database Connectivity takes long time if one of the Node is down .. ??

    Hello All,
    Env: 10.2.0.4 on Solaris 10
    I have 2 nodes.
    When Node1 server is down, it takes long time to connec to the database.
    tnsping would give "OK(2050ms)". Below is the tnsalias.
    RAC_test  =
      (DESCRIPTION =
         (ADDRESS = (PROTOCOL = TCP)(HOST=20.268.169.123)(PORT= 1521))
         (ADDRESS = (PROTOCOL = TCP)(HOST=20.268.169.127)(PORT= 1521))
         (LOAD_BALANCE = yes)
              (CONNECT_DATA =
            (SERVICE_NAME = DK.com)
          (FAILOVER_MODE =
            (TYPE = SELECT)
            (METHOD = BASIC)
            (RETRIES = 180)
            (DELAY = 5)
    )I put the trace on sqlnet.ora and found that first it pings to the "20.268.169.123",
    since the Server is down there will not be any reply and this consumes the delay and
    later it would ping "20.268.169.127" and connect to it.
    If i keep "20.268.169.127" above "20.268.169.123" in tnsalias, and keep "LOAD_BALANCE=no",
    it gets connected very fast, as its directly connecting to Node2. In tnsping i get Ok(40ms).
    How do i reduce the connect timing if i use the first step. Why does it take long time for
    Oracle Client to understand that the Node1 Server is down ?
    TIA,
    J J

    I hope the IP's you are using in the TNS are Virtual IP's.
    You must use Virtual IP's / hostnames for the failover to be quick. If Node 1 is not available then then it's (Node 1's) virtual IP would also get assigned to Node 2 hence all client connections are still able to get a response from the Node Virtual IP address without needing to wait for TCP/IP timeouts. This helps clients to get notified immediately that node 1 is unavailable and the connection tries the 2nd ip/host in the connect descriptor.
    Hope this helps.
    - Siba

  • My lap top is extremly slow. It studders. It kind of sounds like there is a fan inside and it constantly stopping and starting. And, it takes a really long time for it too start up. Whats wrong with it?

    My lap top is extremly slow. It studders. It kind of sounds like there is a fan inside and it constantly stopping and starting. And, it takes a really long time for it too start up. Whats wrong with it?

    Do you have current backups?
    Those symptoms could indicate a failing Hard drive. If it dies, all your documents go with it unless you have Backups.
    I have had very good luck with physical and battery problem diagnosis at the Genius Bar. Those guys put their hands (and their ears) to these machines, all day every day, and they know immediately what all those sounds mean.
    Your appointment for an evaluation is FREE, in warranty or out.

  • Bank statement import FF_5 sometimes takes a really long time

    Hello!
    In the middle of august we started to have problems with bank statement import FF_5 - sometimes (but not always) it takes a really long time (3 - 4 hours) to import data - usually it would take from few minutes to 1 hour (depending on size of import file). There is no error, the documents that match are posted automatically like always, the amount of documents, that are not posted automatically, is the same as always... We didn't do any new settings in system.
    We tried to find cause with debugger and sql trace, but there was no error - the import program works ok, then suddenly it stops in one line and searches in cluster table RFBLG without filled field GJAHR (year) - that means that it searches among approx 7.400.000 records (the size of our RFBLG is appr. 12 Gat the moment).
    We don't have ideas any more, how to find a cause for strange behaviour. The problem is, that there is no rule - sometimes it's ok, sometimes it works very slow - no matter how big the import file is. The problem occurs with all bank files (we have 3 banks).
    Do you maybe have any suggestions, what to do and how to find and eliminate the cause?
    Thankyou in advance for your tips!
    Meti

    Hi Meti,
    Have you tried analysing differences between files that it goes slow on and files where it goes quickly?  Sounds like there is some difference in file data that causes it to do a lookup.  If the traecs are not finding the differences, it might be wortwhile to put the file data into Excel for a slow and a fast and compare field level data?
    Regards,
    Tony

  • Building a .rtexe Takes an Unreasonable Long Time

    Hi all, I have found that building .rtexe's for a mid-sized LVOOP application takes an unreasonably long time.
    In some cases the wait is in excess of ~3h before the compile completes. Debugging any deployment issues on .rtexes then quickly becomes intractable, tedious and costly.
    The class hierarchy below:
    Any takes on the issue?
    Br,
    /Roger

    Intaris wrote:
    You know it would be nice if people would actually give enopugh information so that we can help.
    We do actually like helping but if you want to play the game of looking for problems, than you're going to be running low on helpers I'm afraid.
    I was referring to your question whether what you provided a few posts earlier is enough when it should be rather clear that it cannot be enough to help solving your problem.
    But hey, it's your problem and not mine so why should I bother?  Your contributions ont he forum int he last time have been rather neagtive int one and since we're volunteers here it doesn'0t exactly make me want to spend my own time in helping you.  Sorry, that's just the way the world is.
    Shane.
    Yes, I am a very negative person.
    If you got nothing that provides some valuable or additional information, refrain from posting to my threads. Thanks.
    Br,
    /Roger

  • Why do the mac updates take a ridiculously long time

    why do the mac updates take a ridiculously long time? 10 hours? this is ridiculous - my ISP is 40mbps

    Which updates were you trying to get? If you are going to a very busy web site or server, the connections could be extremely slow. But to wait so long invites troubles.
    If the machine is terribly slow, that should be an indication some maintenance or repair may be needed first. Some keyboard shortcuts can be used to check and attempt repair, and the problem likely is in the Mac.
    Everything from the amount of RAM installed, to the total capacity of the HDD (or SSD) vs free or unused space on the drive, is important to the function of the OS X. Or there may be an issue, if the OS X checks out OK, in the internet connection. If you use wireless mostly, check the connections by wire instead.
    Try to not get into a position where you end up using 'force quit' if the computer appears to freeze up. In the process of an update or upgrade, that's almost never a positive outcome.
    Good luck & happy computing!

  • When query is taking too long time

    When query is taking too long time,Where and how to start tuning it?
    Here i've listed few things need to be considered,out of my knowledge and understanding
    1.What the sql is waiting for(wait events)
    2.Parameter modification need to be done at system/session level
    3.The query has to be tuned (using hints )
    4.Gathering/deleting statistics
    List out any other things that need to be taken into account?
    Which approach must be followed and on what basis that approach must be considered?

    When query is taking too long time,Where and how to start tuning it?explain plan will be good start . trace also
    Here i've listed few things need to be considered,out of my knowledge and understanding
    1.What the sql is waiting for(wait events)When Oracle executes an SQL statement, it is not constantly executing. Sometimes it has to wait for a specific event to happen befor it can proceed.
    Read
    http://www.adp-gmbh.ch/ora/tuning/event.html
    2.Parameter modification need to be done at system/session levelDepend on parameter , define parameter , trace done on session level for example
    3.The query has to be tuned (using hints )Could be help you but you must know how to use .
    4.Gathering/deleting statisticsDo it in non working hours , it will impact on database performance , but its good
    List out any other things that need to be taken into account?Which account ?
    Which approach must be followed and on what basis that approach must be considered?you could use lot of tools , Trace , AWR

  • TS3276 When I send an email no matter how small it now seems to take a much longer time than usual (by watching the gear wheel spinning). Anyone have any ideas how I can get my sending back to a much shorter time?

    When I send an email no matter how small it now seems to take a much longer time than usual (by watching the gear wheel spinning). Anyone have any ideas how I can get my sending back to a much shorter time?

    Have you burned Discs with other programs using this computer? Are you certain that you have a drive that will burn discs?

  • Why this Query is taking much longer time than expected?

    Hi,
    I need experts support on the below mentioned issue:
    Why this Query is taking much longer time than expected? Sometimes I am getting connection timeout error. Is there any better way to achieve result in shortest time.  Below, please find the DDL & DML:
    DDL
    BHDCollections
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[BHDCollections](
     [BHDCollectionid] [bigint] IDENTITY(1,1) NOT NULL,
     [GroupMemberid] [int] NOT NULL,
     [BHDDate] [datetime] NOT NULL,
     [BHDShift] [varchar](10) NULL,
     [SlipValue] [decimal](18, 3) NOT NULL,
     [ProcessedValue] [decimal](18, 3) NOT NULL,
     [BHDRemarks] [varchar](500) NULL,
     [Createdby] [varchar](50) NULL,
     [Createdon] [datetime] NULL,
     CONSTRAINT [PK_BHDCollections] PRIMARY KEY CLUSTERED
     [BHDCollectionid] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    BHDCollectionsDet
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE [dbo].[BHDCollectionsDet](
     [CollectionDetailid] [bigint] IDENTITY(1,1) NOT NULL,
     [BHDCollectionid] [bigint] NOT NULL,
     [Currencyid] [int] NOT NULL,
     [Denomination] [decimal](18, 3) NOT NULL,
     [Quantity] [int] NOT NULL,
     CONSTRAINT [PK_BHDCollectionsDet] PRIMARY KEY CLUSTERED
     [CollectionDetailid] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    Banks
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[Banks](
     [Bankid] [int] IDENTITY(1,1) NOT NULL,
     [Bankname] [varchar](50) NOT NULL,
     [Bankabbr] [varchar](50) NULL,
     [BankContact] [varchar](50) NULL,
     [BankTel] [varchar](25) NULL,
     [BankFax] [varchar](25) NULL,
     [BankEmail] [varchar](50) NULL,
     [BankActive] [bit] NULL,
     [Createdby] [varchar](50) NULL,
     [Createdon] [datetime] NULL,
     CONSTRAINT [PK_Banks] PRIMARY KEY CLUSTERED
     [Bankid] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    Groupmembers
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[GroupMembers](
     [GroupMemberid] [int] IDENTITY(1,1) NOT NULL,
     [Groupid] [int] NOT NULL,
     [BAID] [int] NOT NULL,
     [Createdby] [varchar](50) NULL,
     [Createdon] [datetime] NULL,
     CONSTRAINT [PK_GroupMembers] PRIMARY KEY CLUSTERED
     [GroupMemberid] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    GO
    ALTER TABLE [dbo].[GroupMembers]  WITH CHECK ADD  CONSTRAINT [FK_GroupMembers_BankAccounts] FOREIGN KEY([BAID])
    REFERENCES [dbo].[BankAccounts] ([BAID])
    GO
    ALTER TABLE [dbo].[GroupMembers] CHECK CONSTRAINT [FK_GroupMembers_BankAccounts]
    GO
    ALTER TABLE [dbo].[GroupMembers]  WITH CHECK ADD  CONSTRAINT [FK_GroupMembers_Groups] FOREIGN KEY([Groupid])
    REFERENCES [dbo].[Groups] ([Groupid])
    GO
    ALTER TABLE [dbo].[GroupMembers] CHECK CONSTRAINT [FK_GroupMembers_Groups]
    BankAccounts
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[BankAccounts](
     [BAID] [int] IDENTITY(1,1) NOT NULL,
     [CustomerID] [int] NOT NULL,
     [Locationid] [varchar](25) NOT NULL,
     [Bankid] [int] NOT NULL,
     [BankAccountNo] [varchar](50) NOT NULL,
     CONSTRAINT [PK_BankAccounts] PRIMARY KEY CLUSTERED
     [BAID] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    GO
    ALTER TABLE [dbo].[BankAccounts]  WITH CHECK ADD  CONSTRAINT [FK_BankAccounts_Banks] FOREIGN KEY([Bankid])
    REFERENCES [dbo].[Banks] ([Bankid])
    GO
    ALTER TABLE [dbo].[BankAccounts] CHECK CONSTRAINT [FK_BankAccounts_Banks]
    GO
    ALTER TABLE [dbo].[BankAccounts]  WITH CHECK ADD  CONSTRAINT [FK_BankAccounts_Locations1] FOREIGN KEY([Locationid])
    REFERENCES [dbo].[Locations] ([Locationid])
    GO
    ALTER TABLE [dbo].[BankAccounts] CHECK CONSTRAINT [FK_BankAccounts_Locations1]
    Currency
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[Currency](
     [Currencyid] [int] IDENTITY(1,1) NOT NULL,
     [CurrencyISOCode] [varchar](20) NOT NULL,
     [CurrencyCountry] [varchar](50) NULL,
     [Currency] [varchar](50) NULL,
     CONSTRAINT [PK_Currency] PRIMARY KEY CLUSTERED
     [Currencyid] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    CurrencyDetails
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[CurrencyDetails](
     [CurDenid] [int] IDENTITY(1,1) NOT NULL,
     [Currencyid] [int] NOT NULL,
     [Denomination] [decimal](15, 3) NOT NULL,
     [DenominationType] [varchar](25) NOT NULL,
     CONSTRAINT [PK_CurrencyDetails] PRIMARY KEY CLUSTERED
     [CurDenid] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    QUERY
    WITH TEMP_TABLE AS
    SELECT     0 AS COINS, BHDCollectionsDet.Quantity AS BN, BHDCollections.BHDDate AS CollectionDate, BHDCollectionsDet.Currencyid,
                          (BHDCollections.BHDCollectionid) AS DSLIPS, Banks.Bankname
    FROM         BHDCollections INNER JOIN
                          BHDCollectionsDet ON BHDCollections.BHDCollectionid = BHDCollectionsDet.BHDCollectionid INNER JOIN
                          GroupMembers ON BHDCollections.GroupMemberid = GroupMembers.GroupMemberid INNER JOIN
                          BankAccounts ON GroupMembers.BAID = BankAccounts.BAID INNER JOIN
                          Currency ON BHDCollectionsDet.Currencyid = Currency.Currencyid INNER JOIN
                          CurrencyDetails ON Currency.Currencyid = CurrencyDetails.Currencyid INNER JOIN
                          Banks ON BankAccounts.Bankid = Banks.Bankid
    GROUP BY BHDCollectionsDet.Quantity, BHDCollections.BHDDate, BankAccounts.Bankid, BHDCollectionsDet.Currencyid, CurrencyDetails.DenominationType,
                          CurrencyDetails.Denomination, BHDCollectionsDet.Denomination, Banks.Bankname,BHDCollections.BHDCollectionid
    HAVING      (BHDCollections.BHDDate BETWEEN @FromDate AND @ToDate) AND (BankAccounts.Bankid = @Bankid) AND (CurrencyDetails.DenominationType = 'Currency') AND
                          (CurrencyDetails.Denomination = BHDCollectionsDet.Denomination)
    UNION ALL
    SELECT     BHDCollectionsDet.Quantity AS COINS, 0 AS BN, BHDCollections.BHDDate AS CollectionDate, BHDCollectionsDet.Currencyid,
                          (BHDCollections.BHDCollectionid) AS DSLIPS, Banks.Bankname
    FROM         BHDCollections INNER JOIN
                          BHDCollectionsDet ON BHDCollections.BHDCollectionid = BHDCollectionsDet.BHDCollectionid INNER JOIN
                          GroupMembers ON BHDCollections.GroupMemberid = GroupMembers.GroupMemberid INNER JOIN
                          BankAccounts ON GroupMembers.BAID = BankAccounts.BAID INNER JOIN
                          Currency ON BHDCollectionsDet.Currencyid = Currency.Currencyid INNER JOIN
                          CurrencyDetails ON Currency.Currencyid = CurrencyDetails.Currencyid INNER JOIN
                          Banks ON BankAccounts.Bankid = Banks.Bankid
    GROUP BY BHDCollectionsDet.Quantity, BHDCollections.BHDDate, BankAccounts.Bankid, BHDCollectionsDet.Currencyid, CurrencyDetails.DenominationType,
                          CurrencyDetails.Denomination, BHDCollectionsDet.Denomination, Banks.Bankname,BHDCollections.BHDCollectionid
    HAVING      (BHDCollections.BHDDate BETWEEN @FromDate AND @ToDate) AND (BankAccounts.Bankid = @Bankid) AND (CurrencyDetails.DenominationType = 'COIN') AND
                          (CurrencyDetails.Denomination = BHDCollectionsDet.Denomination)),
    TEMP_TABLE2 AS
    SELECT CollectionDate,Bankname,DSLIPS AS DSLIPS,SUM(BN) AS BN,SUM(COINS)AS COINS  FROM TEMP_TABLE Group By CollectionDate,DSLIPS,Bankname
    SELECT CollectionDate,Bankname,count(DSLIPS) AS DSLIPS,sum(BN) AS BN,sum(COINS) AS coins FROM TEMP_TABLE2 Group By CollectionDate,Bankname
    HAVING COUNT(DSLIPS)<>0;

    Without seeing an execution plan of the query it is hard to suggest something useful. Try insert the result of UNION ALL to the temporary table and then perform an aggregation on that table, not a CTE.
    Just
    SELECT CollectionDate,Bankname,DSLIPS AS DSLIPS,SUM(BN) AS BN,SUM(COINS)AS COINS  FROM
    #tmp Group By CollectionDate,DSLIPS,Bankname
    HAVING COUNT(DSLIPS)<>0;
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Everytime I open Firefox - it takes a really long time and reopens the Firefox Update tab that says "Choose your Persona" and "More ways to Personalize" tab along with my regular home page tab. Sometimes it tries to load the add ons too and takes a reall

    Every time I open Firefox it tries to install the same updates (that I don't want) and the Firefox 3.6 "Choose Your Persona" etc. tab opens along with my home page tab. It takes a really long time to get onto Firefox because of these problems.
    == This happened ==
    Every time Firefox opened
    == Don't remember

    Well, this worked on my desktop! But my problem is on my laptop. :-) I'm running XP, but there was no "Username" under Documents and Settings under the C drive. I did a search for those file names and it wasn't there. I found Mozilla Firefox folder under: C\Documents and Settings\ All Users\Start Menu\Programs\Mozilla Firefox. There are 2 - 1 is Mozilla Firefox (shortcut) and the other is Mozilla Firefox (Safe Mode). I did a Mozilla Firefox search and this is all that showed up.
    When I click on the shortcut link (the 1st one), it opens up 2 screens of Firefox. One is the "this is embarrassing" screen. The other is "Choose your Persona" screen. I closed it and reopened and it took me to my home page.

  • Does your Apple TV take a long time to get to the main menu?

    I have my Apple TV hooked up via HDMI to a Panasonic Plasma. Everything works pretty good except for the recurring missing from devices in iTunes. A restart of iTunes always brings it back.
    I'd like to know if my experience with slow start up is normal. When I switch from my regular TV output to the HDMI output for my Apple TV it takes a really long time to start up. I will get my photos that are my screensaver after about 1 minute. Then it takes another minute and a half or more to get to the main menu after pressing the menu button on the remote. Is this normal? Should it be connecting faster? If so, what can I do to the settings to speed things up.
    Thanks for the help.
    Cheers
    mrjazz

    it can vary depending on the TV you have.
    HDMI handshaking isn't the most reliable thing (in any device).

  • Why does it take me so long time to migrate from my old Mac

    Why does it take me so long time to migrate from my old Mac?
    I just bought a new MacBook Air and using an ethernet cable to migrate all material from my old MacBook Pro, it has now taken med 4 days
    and still not done? What am I doing wrong?

    Thanks for that gbrenik.
    Don't really wanna start reloading all of Lion, but read somewhere that I should start the migration by restarting my source Mac by holding down T during startup, that would do the trick. Is this what I  have done wrong?

Maybe you are looking for