Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Slow SQL Server 2008 when loading a grid using a argument in the sql statement.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Slow SQL Server 2008 when loading a grid using a argument in the sql statement.

    I am new to Alpha Five and maybe I am doing something wrong here. I have used SQL Profiler so I can see what is being sent to the SQL Server.
    Adding an argument(filter) to my SQL statement slows the Grid response to a crawl. If I remove the argument and hard code the filters directly into the statement it responds quickly.

    When using an argument, my SQL statement looks like this:
    SELECT d1, id, mx from logfile where logfile.mx = :mx order by dt

    Below is what gets sent to the SQL Server:

    declare @p1 int
    set @p1=2
    exec sp_prepexec @p1 output,N'@P1 nvarchar(28)',N'SELECT TOP 31 d1, id, mx FROM [logfile] WHERE [logfile].mx = @P1 ORDER BY [logfile].d1 ',N'142434322234'
    select @p1
    THIS TAKES AROUND 3400 ms to run. WAY TOO LONG


    If I take out the argument and and just code the filter directly in the query. My SQL statement now looks like this.
    SELECT d1, id, mx from logfile where mx='142434322234' order by dt

    Below is what gets sent to the SQL Server
    SELECT TOP 31 d1, id, mx from [logfile] where [logfile].mx = '142434322234' order by dt
    THIS SHOWS A DURATION of 0, (less than 1ms) and responds instantly.

    Any ideas?

    Thanks for the help,

    Doug

    #2
    Re: Slow SQL Server 2008 when loading a grid using a argument in the sql statement.

    I changed my sql connection properties to use ODBC instead of the Alpha5 driver for SQL Server 2008. All of the delays went away.

    Comment


      #3
      Re: Slow SQL Server 2008 when loading a grid using a argument in the sql statement.

      sounds like something a bunch of us will be eager to test.
      Steve Wood
      See my profile on IADN

      Comment


        #4
        Re: Slow SQL Server 2008 when loading a grid using a argument in the sql statement.

        I am also having performance problems with MSSQL 2012 and am finding the OBDC driver significantly faster than the built-in MSSQL 2012.

        Using the SQL Profiler here are my results.
        Buit-in 2012 driver: Time Taken - 7 milliseconds
        declare @p1 int
        set @p1=1
        exec sp_prepexec @p1 output,N'@P1 nvarchar(10)',N'SELECT mfg_part_no FROM invtry WHERE part_no = @P1',N'ABCD'
        select @p1
        ODBC Driver: Time Taken - 0 milliseconds (meaning less than 1 millisecond)
        declare @p1 int
        set @p1=1
        exec sp_prepexec @p1 output,N'@P1 varchar(10)',N'SELECT mfg_part_no FROM invtry WHERE part_no = @P1','ABCD'
        select @p1
        Look at the attached image of the client statistics. Trial 1 is using the Alpha statement while Trial 2 is using the OBDC statement. The problem seems to be that alpha is using unicode even though the fields are not unicode and the DBMS has to convert the table
        ClientStats.png

        Attached below is the execution plan of each select statement. The first is Alpha's statement where it needs to use a join because the datatypes don't match. Whereas the ODBC statement uses the correct datatype and therefore can us the index.
        ExecPlan_Alpha.pngExecPlan_ODBC.png

        Comment


          #5
          Re: Slow SQL Server 2008 when loading a grid using a argument in the sql statement.

          Can you post a screen shot of the options you selected in your "Create SQL Connection String" dialog?

          Thanks

          Comment


            #6
            Re: Slow SQL Server 2008 when loading a grid using a argument in the sql statement.

            I am using the default settings.
            DBCS.png

            Comment


              #7
              Re: Slow SQL Server 2008 when loading a grid using a argument in the sql statement.

              Thanks Jay. That looks like the built-in driver. Can you post a screen shot of your ODBC settings? I think you said you were getting better results with ODBC.

              I tried ODBC, and ADONET with 3 different providers ('System.Data.Odbc, System.Data.OleDb, and System.Data.SqlClient). The speed seems about the same when I run a long report no matter which driver I use. I haven't tried running the profiler yet because I was hoping to see a noticeable difference in speed between the native Alpha driver and ODBC.

              Thanks

              Comment


                #8
                Re: Slow SQL Server 2008 when loading a grid using a argument in the sql statement.

                My ODBC connection settings.
                MSODBC.png


                I am using ODBC driver SQL Server Native Client 11.0 with all the default settings.
                ODBCDriver.png

                Comment


                  #9
                  Re: Slow SQL Server 2008 when loading a grid using a argument in the sql statement.

                  Thanks, that helped. I was using ADO.NET with Native Client 10.0. I just created another named data source using ODBC and Native Client 10.0. I'm using SQL Server 2008.

                  Comment


                    #10
                    Re: Slow SQL Server 2008 when loading a grid using a argument in the sql statement.

                    Dave,

                    Have you noticed a performance difference and/or used SQL Profiler to see if you have a difference in SQL when your using arguments?

                    Comment


                      #11
                      Re: Slow SQL Server 2008 when loading a grid using a argument in the sql statement.

                      Jay,

                      I have not noticed any performance difference between the native alpha SQL Server data source and any combination of ODBC or ADO.NET data source configurations. I tested the Native Client provider with both ODBC and ADO.NET. I haven't taken the time to configure and run the SQL Server profiler yet. I tested a report that takes about 10 seconds to query the data. Perhaps this is not enough data to detect any appreciable gain in performance. I have 6 arguments defined in the data source definition. Three arguments are used in the WHERE clause and one argument is used in the report's internal Select records filter. This causes Alpha to make a second pass of the temporary report data files to filter on an argument that requires a special UDF function. I could not figure out a way to do this through SQL, so I just wrote a function to analyze the data and return true if the record should be included in the report. I did not measure the second pass through the temporary data, just the first pass which queries the data from the SQL server.

                      Comment


                        #12
                        Re: Slow SQL Server 2008 when loading a grid using a argument in the sql statement.

                        Anyone else run SQL Profiler?

                        Comment

                        Working...
                        X