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

Query vs. Indexing?

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

    Query vs. Indexing?

    Hey guys,
    There is probably a very simple solution to this, but every one of my "print preview" reports is taking forever to load. My reports are base on sets. I run my xbasic script and then Alpha runs through every single child record instead of filtering with my variables. For example, if I have 1,000,000 records and I only need 3 records on my report, it scrolls through all 1,000,000 records at the bottom of my screen (I guess it's filtering), and then shopw my final data. The problem i'm having is this can take 5-10 minutes where if I do the same thing in access, it takes 10 seconds.

    I'll attach my xbasic script to see if anyone wants to take a stab at this. I would assume that Alpha should just filter out the un-needed data based on my key, and that should be pretty fast.

    Steve Hall
    Intellicall, Inc.
    Steve Hall

    #2
    Lightning Query Optimization

    Originally posted by spain246
    Hey guys,
    There is probably a very simple solution to this, but every one of my "print preview" reports is taking forever to load. My reports are base on sets. I run my xbasic script and then Alpha runs through every single child record instead of filtering with my variables. For example, if I have 1,000,000 records and I only need 3 records on my report, it scrolls through all 1,000,000 records at the bottom of my screen (I guess it's filtering), and then shopw my final data. The problem i'm having is this can take 5-10 minutes where if I do the same thing in access, it takes 10 seconds.

    I'll attach my xbasic script to see if anyone wants to take a stab at this. I would assume that Alpha should just filter out the un-needed data based on my key, and that should be pretty fast.

    Steve Hall
    Intellicall, Inc.
    You can use the between() function to speed things up as it is conducive to LQO.

    Code:
    "(Cdr->Offhookdate>= Var->begindate ) .and. (Cdr->Offhookdate<=Var->enddate )"
    
    would become
    
    "between(Cdr->Offhookdate,{"+ dtoc(Var->begindate)+"},{"+dtoc(Var->enddate)+"}"
    
    seeing as the variables are date type.
    If this helps I'd be glad to help construct the other filter statements.

    Slow afternoon, here's the rest...

    Code:
    "between(Cdr->Offhookdate,{"+ dtoc(Var->begindate)+"},{"+dtoc(Var->enddate)+"} .and. (Phone->ani="+Var->ani+" )"
    if var->ani is numeric
    "between(Cdr->Offhookdate,{"+ dtoc(Var->begindate)+"},{"+dtoc(Var->enddate)+"} .and. (Phone->ani='"+Var->ani+"' )"
    if var->ani is character
    
    assuming the Var->serial, Var->account, and Var->service are character types.
    
    "between(Cdr->Offhookdate,{"+ dtoc(Var->begindate)+"},{"+dtoc(Var->enddate)+"} .and. (Phone->serial='"+Var->serial+"')"
    
    "(Phone->sysdesc2='"+Var->account+"' ) .and.between(Cdr->Offhookdate,{"+ dtoc(Var->begindate)+"},{"+dtoc(Var->enddate)+"}"
    
    "(Phone->servzone='"+Var->service+"' ) .and.between(Cdr->Offhookdate,{"+ dtoc(Var->begindate)+"},{"+dtoc(Var->enddate)+"}"
    Last edited by Stan Mathews; 11-30-2005, 06:28 PM. Reason: Additional filters
    There can be only one.

    Comment


      #3
      Stan,
      It's still scanning every record in my child table, then it's creating it's own table through the print preview option. The DTOC won't work for some reason as well.

      The same thing happens when I create a query operation. Instead of just automatically filtering the data between the dates, it scans every record. Is there anyway it can just quickly autofilter with my variables based on the date range?

      It seems to go pretty quick when I open the table or set individually and filter that way.

      Steve Hall
      Steve Hall

      Comment


        #4
        Steve,

        You may be unfamiliar with Lightning Query Optimization. There's a useful section on this in the Chapter of the User Guide dealing with Searching and Sorting Records.

        If you are using search criteria targeting the child table, you might benefit from creating a new set, inverting the present arrangement and using 1:1 link.
        The filter on the primary table in the set sholuld perform faster.

        -- tom

        Comment


          #5
          About four years ago, I ran into this situation. No amount of script and/or report tweaking solved the problem. While it was only affecting a couple of clients among many, it was a major deal. My solution (using temporary tables) may seem like a lot of work, but in the context of the time spent chasing unsuccessful fixes, it was nothing. We now use this method for all of our major printing. I've described the method elsewhere and, if you're interested I can go into detail.

          F.
          Finian

          Comment


            #6
            Finian, yes, I'm interested in the details of the method you mention. Thanks.

            -- tom

            Comment


              #7
              I'm definately interested as well.

              Steve Hall
              Steve Hall

              Comment


                #8
                Originally posted by spain246
                ...............It's still scanning every record in my child table............
                Hello Steve,

                Have you built an index on your child table field: Offhookdate? This should be a simple index just listing the field as the index expression. This should allow LQO at work.

                I have occassionally ran into situations where it seemed no matter what, Alpha insisted on running a new query even when an existing index existed where LQO could be used. Going way back to v3 I ran into a situation where three different settings would cause this, but for the life of me, I don't remember what the issues where. Seems like it had something to do will the current filter on the form, and something in the report settings. I did keep notes on this issue.......... if I can find them now :-(

                Good luck,
                Jim

                Comment


                  #9
                  Any other filter or order on this report? Also it doesn't look like you replace_parameters() will do anything as your variables in the original string are not encapsulated within brackes []

                  Jim

                  Comment


                    #10
                    Jim,
                    I have removed all the fliters on this report. I originally had it filtering out some things.

                    Steve
                    Steve Hall

                    Comment


                      #11
                      Tom,
                      I just followed the parameters for the Lightning Query Optimization (LQO) and was just curious as to how fast this should work. I just want to check a few things.

                      1. The only place that a filter should be setup is actually in the query? (Operation)

                      2. The data type of my index must match the datatype of the field I am searching. What if it is a date? Does it have to be a character field?

                      3. What would make a good order expression?

                      I tried also rebuilding the set inversely, and had mixed results.

                      I put a filter on the report since I couldn't put it in my set. When I just checked a single day, it took 51 secs vs. 2:51. That was much better.

                      When I do multiple dates (ex:01/01/05 - 03/31/05) It goes back to scanning all of the records again and took 10 minutes.

                      Any thoughts? (I would love to see how Finnian is fixing this problem)
                      Steve Hall

                      Comment


                        #12
                        A comprehensive description of how to set this up will take me a little while to do. It will be about a week before I can get to it. Sorry.

                        Finian
                        Finian

                        Comment


                          #13
                          Hello Steve,

                          Are you calling the print routine from a form? If so is the form based on the same set or table/s that are involved in the report? Do you have a filter on the form?

                          I'd try starting with a clean boot of Alpha. Make sure you don't have any filter or order on the report. Also make sure that the report properties does not have "Base Report on currently selected Records". "None" should be selected here. Run a script that calls the report with a simple filter, possibly just a given date for your field. Don't open any form or instance of the table before you try running the report.

                          Could you post your tables and set here so we could see what you are doing?

                          Jim

                          Comment


                            #14
                            Database Copy

                            Jim,
                            All of my queries are built into buttons on my forms. The one thing that i've noticed is that when I open a set and run a query, it seems to check every single record. If you have several million records, it takes forever! I've tried inverting files and several other things. I can do the same thing in access and it takes 3 seconds as opposed to Alpha's 5 minutes.

                            I've attached a copy of some of my database if anyone wants to take a stab at this.

                            Steve Hall
                            Steve Hall

                            Comment


                              #15
                              Database

                              Here's the zip file.

                              Steve
                              Steve Hall

                              Comment

                              Working...
                              X