Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8531639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:32:00+00:00 2026-06-11T09:32:00+00:00

I have an application in Android (running 4.0.3) that stores a lot of data

  • 0

I have an application in Android (running 4.0.3) that stores a lot of data in Table A. Table A resides in SQLite Database. I am using a ContentProvider as an abstraction layer above the database.

Lots of data here means almost 80,000 records per month. Table A is structured like this:

String SQL_CREATE_TABLE = "CREATE TABLE IF NOT EXISTS " + TABLE_A + " ( " + 
        COLUMN_ID + " INTEGER PRIMARY KEY NOT NULL" + "," + 
        COLUMN_GROUPNO      + " INTEGER NOT NULL DEFAULT(0)" + "," + 
        COLUMN_TIMESTAMP    + " DATETIME UNIQUE NOT NULL" + "," + 
        COLUMN_TAG          + " TEXT" + "," + 
        COLUMN_VALUE        + " REAL NOT NULL" + "," + 
        COLUMN_DEVICEID     + " TEXT NOT NULL" + "," +
        COLUMN_NEW          + " NUMERIC NOT NULL DEFAULT(1)" + " )";

Here is the index statement:

String SQL_CREATE_INDEX_TIMESTAMP = "CREATE INDEX IF NOT EXISTS " + TABLE_A +
        "_" + COLUMN_TIMESTAMP + " ON " + TABLE_A + " (" +
        COLUMN_TIMESTAMP + ") ";

I have defined the columns as well as the table name as String Constants.

I am already experiencing significant slow down when retrieving this data from Table A. The problem is that when I retrieve data from this table, I first put it in an ArrayList and then I display it. Obviously, this is possibly the wrong way of doing things. I am trying to find a better way to approach this problem using a ContentProvider. But this is not the problem that bothers me.

The problem is for some reason, it takes a lot longer to retrieve data from other tables which have only upto 12 records maximum. I see this delay increase as the number of records in Table A increase. This does not make any sense. I can understand the delay if I retrieve data from Table A, but why the delay in retrieving data from other tables.

To clarify, I do not experience this delay if Table A is empty or has less than 3000 records.

What could be the problem?

EDIT: 09/14/2012 9:53 AM

To clarify, I am using a ContentProvider to manage the database. To query the data, I am using the context.getContentResolver().query method.

My query code in the ContentProvider:

@Override
public Cursor query(Uri uri, String[] projection, String selection,
        String[] selectionArgs, String sortOrder) {
    final SQLiteQueryBuilder queryBuilder = new SQLiteQueryBuilder();
    final SQLiteDatabase db = dbHelper.getReadableDatabase();

    String tableName = getTableName(uri);

    queryBuilder.setTables(tableName);

    Cursor cursor = queryBuilder.query(db, projection, selection, selectionArgs, null, null, sortOrder);
    cursor.setNotificationUri(getContext().getContentResolver(), uri);

    return cursor;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T09:32:01+00:00Added an answer on June 11, 2026 at 9:32 am

    So this is embarrassing:

    Apparently, there was one line of code somewhere during the Application Load that was retrieving data from Table A. That was what was slowing down the application as a whole.

    In any case, I still have to figure out how to optimize loading data from Table A using a ContentProvider.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have android application that I need to debug using eclipse. When I right
I have an android application that is running. After a while when user quits
I have an android application that begins by downloading a large database to the
I have an android application that I want to always be running in landscape
I have an android application. There are a lot of buttons in it but
I have an android application that launches a child Activity under certain situations. Both
I have an Android application that connects to Facebook to request authorization of an
I have an AppEngine application that uses the blobstore to store user-provided image data.
I have a application in Android that has a broadcast receiver that clear any
I have a service running that contains an SQLite DB and a Content Observer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.