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

How To Append Without Updating All Indexes

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

    How To Append Without Updating All Indexes

    I have a master table "products_shapshot" with over .75 million records. Twice daily, an additional 1510 records is appended to it from "products".
    When I run the operation it takes about 5 minutes to append, After searching the message board I found out that if i open the products_shapshot table, its takes about 5 seconds or less. This worked great for a while, but now, if I run the append operation with the table open, it fails and suggest that the indexes are corrupted and I should update them. Updating them does not help, I can only append with the products_shapshot table close, but its a huge inconvenience because of the time it takes and the fact that at least 3 departs have to log out of alpha to facilitate this.

    Is there any pointers as to where I'm going wrong?
    From what I understand, its not the append itself that's taking that long, but the updating of all .75 million records in the products_shapshot table.
    Is there another method of appending the records to products_shapshot without having to wait while all .75 million records get their indexes updated? Maybe a way to only update the 1510 records that added?

    #2
    Re: How To Append Without Updating All Indexes

    When I ran into a similar issue I coded to

    drop the indexes
    append records
    re-create the indexes

    That doesn't sound like it will work for you.

    It also doesn't sound like the indexes alone are your issue. More likely that others are using the table and Alpha is having to coordinate the append with other activity for the table.
    There can be only one.

    Comment


      #3
      Re: How To Append Without Updating All Indexes

      Ur right Stan, dropping and recreating the indexes would not work for me, it would still take considerable time to recreate them.

      As for others using the table, That was intentional, since having the table open considerably speed up the append process. However, now, even if I unplug the network cable to ensure that only I am using the app, it still fail to append once the table is open, it works only if the table is closed, but it takes too long.

      Comment


        #4
        Re: How To Append Without Updating All Indexes

        Nigel, are you running saved append operations?

        If so, have you tried entering the records using an xbasic script? I'm wondering if the batch_begin and batch_end methods of the table object will help?

        Comment


          #5
          Re: How To Append Without Updating All Indexes

          Yes Tom, I am running a saved Append operation.
          I looked up batch_begin in the documentation, but I don't think I quite get it as to how to go about "entering the records using an xbasic script", any particular page you cud direct me to as to how to accomplish that?

          Comment


            #6
            Re: How To Append Without Updating All Indexes

            it would still take considerable time to recreate them
            Possibly, but less than having the indexes update as each record is appended.

            Capture the xbasic for your append, save it as a script.
            Change the line similar to


            a_tbl = table.open("lewismkt")

            change it to

            a_tbl = table.open("lewismkt",FILE_RW_EXCLUSIVE)

            Run that with the network cable unplugged.
            Last edited by Stan Mathews; 06-17-2014, 02:56 PM.
            There can be only one.

            Comment


              #7
              Re: How To Append Without Updating All Indexes

              Hey Stan! I get the very same result when I try that. It works very slowly when the table is not open, and it fails when the table is open.

              Comment


                #8
                Re: How To Append Without Updating All Indexes

                There is so many implications in the question. Append without updating the indices implies you don't really need those indices for whatever tasks the users are doing, at least not at that time.
                So, the question is, what are you using these indices for?
                I have advocated in the past for the fewest possible indices.
                Second, you are asking if you could update the incises for just those added records. Does not work that way. The entire index, all indices, have to be re-written.
                Thirdly, do you need all these records in a day-to-day use?
                How about achieving the old records?
                Fourth: How do you know that the indices is the bottle neck?
                To find out, you could do one of two things:
                1-Run a profiler, or
                2-Copy the entire table without the indices and run the same operation and see how long it takes.
                None of the above answers your question, but if we go along with the assumption that the culprit is the indices and since you want somehow someway to suspend these indices, a quick easy way to do that is to duplicate the table with another empty one. Append to the new table and at the end of the day, append that table to the original one and empty it.

                Comment


                  #9
                  Re: How To Append Without Updating All Indexes

                  http://wiki.alphasoftware.com/~alpha...end+Operations
                  according to this page from wiki
                  append operation locks the master table, ( I am guessing no need for rw_exclusive), appends the table and creates the indices. this happens if the table is not open. this is good for large files. on the other hand, if the table is open then alpha appends a single record updates the index then the same all over again. so this may be the problem not just indices. the table may need to be closed during that time everywhere.

                  An append operation takes the records from the transaction table and adds them to the data in the master table. The append operation:

                  1.locks the master file


                  2.appends all the records from the transaction file


                  3.updates any indexes


                  This speeds up merges of large files. If any one else has the master table open, or if you open another form using the master table, the append will update the indexes after each record append.
                  from wiki.
                  thanks for reading

                  gandhi

                  version 11 3381 - 4096
                  mysql backend
                  http://www.alphawebprogramming.blogspot.com
                  [email protected]
                  Skype:[email protected]
                  1 914 924 5171

                  Comment


                    #10
                    Re: How To Append Without Updating All Indexes

                    Nigel,

                    entering records using an xbasic script is not that difficult and there are lots of examples here and in the helps. If you aren't familiar with it let us know. Maybe someone can coach you. Its a valuable skiill to learn.

                    Question: How many index tags have you defined for this table? You know of course that each index tag creates a separate sorted list of record numbers, so the more tags the slower updates will run. You may be thinking that you are updating a single index, when in fact alpha has to update all of the index tags separately. On large tables it often pays to reduce the number of index tag definitions to improve performance.

                    Comment


                      #11
                      Re: How To Append Without Updating All Indexes

                      Ok Gabriel,
                      I tried the profiler in an inline action script, I got no results, the trace window showed nothing, not sure what I did wrong. I deleted all the indexes from the table and run the saved append operation with the table open, it went through at a very satisfactorily speed. So I guess it is the indexes that is the problem.

                      I do need the indexes in that table for multiple data retrieval daily, What I don't need daily is all of the records in the table. Usually all the work is done with the last and the 2nd to last set of 1500 records, but occasionally we do go back farther in the pat that does involve lot more records.

                      Yes Tom, I am not familiar with batch entering of records using xbasic, I would appreciate any assistance given.
                      I defined 15 tags and one got created automatically "__A5_Recor"

                      Comment


                        #12
                        Re: How To Append Without Updating All Indexes

                        Well, sounds to me you need to "archive" the old records in a different table.

                        Comment


                          #13
                          Re: How To Append Without Updating All Indexes

                          Nigel,

                          I had issues with the profiler too, no result in the trace window.
                          The only way I got a result was to write to a text file.
                          Another issue I found was that using the profiler in a UDF didn't work.
                          This is how I did it:
                          profiler_begin()
                          part of the script you want to profile
                          profiler_end("C:\yourfile.txt",.T.)
                          Jo Hulsen
                          Dommel Valley Solutions
                          The Netherlands

                          Comment


                            #14
                            Re: How To Append Without Updating All Indexes

                            15 indexes ! This is something I would never do, especially on a large table, especially for a multi-user (networked) application.

                            I'm curious how many of them have tag names that are longer than 10 characters?

                            How many of the index tags include filters?

                            What version of windows is being used?

                            How much RAM is available on the workstations? ... on the server?

                            Are other large applications running on the workstations or server when Alpha Five is being used?
                            Last edited by Tom Cone Jr; 06-18-2014, 06:43 AM.

                            Comment


                              #15
                              Re: How To Append Without Updating All Indexes

                              Thanks Jo, that method work perfectly.


                              None of my field or tag names are ever longer that 10 characters
                              None of the tags have a filter
                              My development PC is Windows 8 64bit
                              the server and stations are all Windows XP, 1 Gig RAM
                              Usually, there is no other software running, occasionally: Google Chrome, MS Excel, MS Word

                              Comment

                              Working...
                              X