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

  • Home
  • SEARCH
  • 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 3997244
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:22:41+00:00 2026-05-20T07:22:41+00:00

My table represents a hierarchical structure with following columns: int ID (PK, unique, not

  • 0

My table represents a hierarchical structure with following columns:

int ID (PK, unique, not null)
int ParentID 
int MasterID (not null)
smallint Type (not null)
varchar(255) Name

I need to query this DB by:

  • Getting one entry via ID
  • Getting all children of an item (query by ParentID and limit to one specific MasterID)
  • Getting all children of an item of a specific Type

Which indexes would I define preferably on this Sqlite DB?
Also noteworthy: I need to bul insert quite some records (delete everything that belongs to a specific MasterID and then insert appr. 20000 rows). I think defining to many indexes will decrease performance, right? Currently I insert 500 records at a time and wrap it in “BEGIN” and “END”.

Also which other settings should I apply to the DB especially in the scenario of iOS?

  • 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-05-20T07:22:41+00:00Added an answer on May 20, 2026 at 7:22 am

    Which indices you define will be directly affected by whichever keys you are looking up. As a general rule, anything in a relationship (foreign keys) will be a good place for an index. At first glance, I’d suggest indexing your int datatypes, because it’s inexpensive. Keep in mind though, only index if it adds performance. In this case, testing is the way to go.

    You may add indexes and have it turn out that it just slows you down (indices slow down write operations, but will never slow down a read). Best to test in various configurations. There’s no catch-all for how to create indexes. If you post the queries you’re running, we might be able to give a little more insight.

    Finally, keep indexes as narrow as possible (ie – don’t create it on multiple columns unless you’ve tested a ton and found that to be the most performant)

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

Sidebar

Related Questions

Given a table that represents a hierarchical tree structure and has three columns ID
I have table with two columns (varchar from, varchar to). This table represents connections
CREATE TABLE `categories` ( `idcategories` INT NOT NULL AUTO_INCREMENT , `idparent` INT NULL ,
Suppose I have two columns in a table that represents a graph, the first
I have a categories table that has a structure: categoryId parentId categoryName This table
I have 7 tables. Each table represents transmission type where each row in table
I have a table (DB_TableInfo) in my DB like the following TableId Type 859374678
I have a table that represents the parameters of a contract - including their
in my jqgrid i have field in a table which represents the id and
In my Yii application, I have a model that represents siteconfig table and have

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.