Android Question Large Database

Discussion in 'Android Questions' started by Enthousiastic, Jun 15, 2015.

  1. Enthousiastic

    Enthousiastic Active Member Licensed User

    Hello , i have a database .db format made by sqlite having 11.000 records . I use Table class module , to display it and all are OK .
    The problem is that is slow in loading even in an 8core Samsung tablet.
    Any idea if there is a method made it faster ? Th database is 8MB and i cannot send you because of size limitation.


    Many thanks Enthousiastic
     
  2. DonManfred

    DonManfred Expert Licensed User

    You should consider to display only X datasets ()50, 100) and reload more if needed...
     
    KMatle and Mahares like this.
  3. Mahares

    Mahares Well-Known Member Licensed User

    If Erel sees this thread he will advise you that it is not at all practical to try to display 11000 records at once.
    1. Break up the data by using WHERE clauses to display only pertinent data.
    2. In your SQL statement, request only the needed columns. Do not use all of them.
    3. Indexing table by some columns will help, although many indexed fields can slow it down.
    4. As a last resort use: SQL1.ExecQueryAsync(.......
     
    mangojack and DonManfred like this.
  4. Troberg

    Troberg Well-Known Member Licensed User

    Well sometimes you have to display lots of data at once. Sometimes, it's possible to do a "load on demand" to speed things up, sometimes (such as displaying data in maps), you just have to read it all in one chunk.

    That said, all the normal database optimizations should work.

    I wouldn't say that 11000 records is a large database, though. I have databases with 20 million records (although, not on a mobile device), and even those are not considered large by database standards. This makes me suspect that the performance problem is not in the database, but in the display. Try timing just the database operations, to see if the problem is really there.
     
  5. Peter Simpson

    Peter Simpson Well-Known Member Licensed User

    I had the exact same problem with the Table Class @Enthousiastic, what I did to speed up the population of tables apart from using Limit in the query was the following.

    Move the following lines directly into the Table Class, this does speed up the population by quiet a lot. Just experimenting by moving table settings lines directly into the Table Class, I found that helped a lot.
    Code:
    'Move these lines
        Table1.HeaderColor = Colors.Blue
        Table1.HeaderTextColor = 
    Colors.Yellow
        Table1.TextColor = 
    Colors.Blue
        Table1.TableColor = 
    Colors.Red
        Table1.RowHeight = 
    50dip
        Table1.RowColor1 = 
    Colors.RGB(244,164,96)
        Table1.RowColor2 = 
    Colors.RGB(255153255)
        Table1.AllowSelection = 
    False
    I may also have moved the following into the table class as well.
    Code:
    Table1.MultiSelect = False
        Table1.SortColumn = 
    False
        Table1.SingleLine = 
    False
    Admittedly I've turned the Table Class into a library as I personally prefer to use it that way.

    Enjoy...
     
  6. keirS

    keirS Well-Known Member Licensed User

  7. Enthousiastic

    Enthousiastic Active Member Licensed User

     
  8. Enthousiastic

    Enthousiastic Active Member Licensed User

    Sorry i don't understand the module i use is the following .bas .Where can i put the above lines ?
     

    Attached Files:

  9. Peter Simpson

    Peter Simpson Well-Known Member Licensed User

    You take those lines out of the module that your table is in, and put them in the Table Class...
     
Loading...