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

Why Does A SQL Inner Join Bring Performance To A Crawl?

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

  • christappan
    replied
    So three things:
    1) If you go to the query definition in Alpha and click on Native SQL you can see if there's something weird about the query being run in SQL Server.
    2) the demo video in the app is using a where clause and the demo in SSMS isn't. Is the query still lightning fast in SSMS when you filter by the criteria you're showing in the Alpha video?
    3) I've found that LEFT OUTER JOIN can perform a lot faster than INNER JOIN at times, so if it will produce the same records, you could try that.

    Leave a comment:


  • lgrupido
    replied
    Have you tried the view yet? That would take the join out of Alpha completely. (And you need to index the foreign key.)

    If you would like, I could hop on a teamviewer session with you to take a look.

    If you want to do that, private message me and I'll give you my direct email/phone.

    Leave a comment:


  • madtowng
    replied
    WOW!!!!!!!!!! that makes quite a difference.
    Just to be fair, I use mysql. I'm very inexperienced with lists, but seem to do well with sql.
    I created a list that uses the query shown below,
    The samsaraugdrivers has 96 rows, the samsaradutylogs table as almost 232000 rows.
    The time to load the data, and the responsiveness while scrolling through the data is sluggish at best without using virtualization.
    Using virtualization, I get my data relatively quickly and am quite happy with the speed scrolling through the data.
    I opted against pagination and turned off the Get count of Records option because I wanted to avoid having the query performed twice.

    Now I need to learn how to create a search option and selectively display fields. Being able to show more data by clicking on a cell would be even better.

    I know it's late to say in short, but try the virtualization setting. It really makes a difference.


    2021-08-26_14-19-51.png
    Code:
    SELECT DL.seq,DL.logdate,DL.samid,SD.idnum,SD.drivername,DL.dutystatus,DL.statusbeg,
    DL.statusfin,DL.latitude,DL.longitude,DL.samvehid,DL.codriver
    FROM samsaradutylogs DL
    LEFT JOIN samsaraugdrivers SD ON DL.samid = SD.samid

    Leave a comment:


  • iRadiate
    replied
    Originally posted by mikeallenbrown View Post
    Rendering 13,000 records into your list is what might be slowing you down. The query is fast in SSMS. Not sure how a view would help. The list still needs to render 13K records.

    Have you tried playing with the virtualization options? You can limit the number of rows rendered in the list.

    Ashampoo_Snap_Thursday, August 26, 2021_08h17m28s_001_.png
    I'm only bringing back 100 rows at a time in the List with pagination.

    List Pagination.jpg


    Virtualization.jpg

    The problem is with what Alpha is doing with the query behind the scenes. Have a look at the comparison videos above.
    Last edited by iRadiate; 08-26-2021, 09:57 AM.

    Leave a comment:


  • iRadiate
    replied
    Just to demonstrate how drastic a performance hit Alpha is introducing to the list query, take a look at this:

    1. Alpha List - Query Without Join (< 2 seconds)

    https://www.screencast.com/t/cGj5l5NEe


    2. Alpha List - Query With Join (> 15 seconds)

    https://www.screencast.com/t/pSISxYjzy9f


    3. SSMS - Query With Join (< 1 second)

    https://www.screencast.com/t/mh5S46yGX
    Last edited by iRadiate; 08-26-2021, 09:32 AM.

    Leave a comment:


  • mikeallenbrown
    replied
    Rendering 13,000 records into your list is what might be slowing you down. The query is fast in SSMS. Not sure how a view would help. The list still needs to render 13K records.

    Have you tried playing with the virtualization options? You can limit the number of rows rendered in the list.

    Ashampoo_Snap_Thursday, August 26, 2021_08h17m28s_001_.png

    Leave a comment:


  • iRadiate
    replied
    Yes, definitely some good options to explore.

    Thanks to all for the great suggestions.

    Leave a comment:


  • Lance Gurd
    replied
    It definitely helped me, views a others have suggested is a great way to go so that SQL does all the work of getting the data you want. Then there is sub-queries to get your data, in my experience these are blindingly fast in comparison to a normal join

    Leave a comment:


  • iRadiate
    replied
    Originally posted by Lance Gurd View Post

    I don't just mean that the tables are indexed, I mean the the linking field in both tables is indexed in a separate index, in your case this would be an index on MACID in the repairs table and MACHINEID in the machines table
    I see what you mean, the 2 tables have clustered indexes on the primary keys. So repairs is indexed on repairid (not macid). And machines is indexed on machineid. These were the auto generated indexes by SQL when the tables were created.
    So, I 'could' add a non-clustered index on repairs.macid.

    What I really don't understand is why the query runs fast in SSMS but in Alpha it is painfully slow. (only when the query is changed to use the join).
    However, I will try your suggestion to see if it helps, though I want to try this on my test system first not the production system.

    Thanks
    Last edited by iRadiate; 08-26-2021, 08:40 AM.

    Leave a comment:


  • peteconway
    replied
    Lance just use a view.

    Leave a comment:


  • Lance Gurd
    replied
    Originally posted by iRadiate View Post

    Lance, yes the tables are indexed.
    I don't just mean that the tables are indexed, I mean the the linking field in both tables is indexed in a separate index, in your case this would be an index on MACID in the repairs table and MACHINEID in the machines table

    Leave a comment:


  • madtowng
    replied
    I've been avoiding lists because A. my first try created a horribly slow experience, and B. They seem far too complicated to work with compared to a grid.
    With that said, for purposes of testing the sql statement, I would try it with a grid or even a simple (non-list/viewbox) ux.

    Leave a comment:


  • lgrupido
    replied
    From within SSMS, use the following:

    create view myviewname as
    select statement

    That will create the view and then you use it in Alpha like you would any table.

    Caveat: Your select statement looks like it should create an editable view, but if not you may need to do some manual updating if you intend to use this list to update records. (other than saving it in a standard detail view.)

    Leave a comment:


  • iRadiate
    replied
    Originally posted by lgrupido View Post
    Ditto on the index, but if it is fast in SSMS, then I am guessing the index is there.

    Thought 1)
    My next thought would be - do you really need all of those fields in the query?

    If not, I would remove any fields you do not need. The amount of data being pulled in will have an effect on the list being populated.

    Thought 2)
    You should try creating this select statement as a view. So create a view with the exact same statement and then try pulling the view into the list instead of doing the join inside the list query as you are now.

    You may find that to be much faster also.
    Larry,

    Thought 1 - I do need the fields.

    Thought 2 - I've never done that, create a view. So not sure how you do that or how you use it, but I will do some reading and look into it.

    Thanks for the suggestions.

    Leave a comment:


  • iRadiate
    replied
    Originally posted by Lance Gurd View Post
    Is repairs.MacID indexed, I recently introduced more indexes to my joined query tables and this helped
    Lance, yes the tables are indexed.

    Leave a comment:

Working...
X