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 9170901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:05:27+00:00 2026-06-17T16:05:27+00:00

My table has the following fields: Date (integer) State (integer) ProductId (integer) ProductName (integer)

  • 0

My table has the following fields:

  1. Date (integer)
  2. State (integer)
  3. ProductId (integer)
  4. ProductName (integer)
  5. Description (text) (maximum text lenght
    3000 characters)

There will be more than 8 million rows. I need to decide whether I should put the product description in another table. My main goal is to have this statement very fast:

SELECT Date,State,ProductId,ProductName FROM tablename ORDER BY DATE desc LIMIT 100

The SQL result will not fetch the Description field value in the above statement. The user will see the description only when the row is selected in the application (new query).

I would really want to have the product Description in the same table, but I’m not sure how SQLite scans the rows. If Date value doesn’t match I would assume that SQLite can quickly skip to the next row. Or maybe it needs to scan all fields of the row till it gets to the end of the Description field value in order to know that the row has ended? If it needs to scan all fields to get to the next row will the value of 3000 characters in the Description field decrease the speed a lot?

EDIT: No indexing should be used since INSERT speed is important.

EDIT: The only reason of trying to have it all in one table is that I want to do INSERTs and UPDATEs in one transaction of hundreds of items. The same item could be inserted and later updated in the same transaction, so I can not know the last insert id per item.

  • 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-17T16:05:27+00:00Added an answer on June 17, 2026 at 4:05 pm
    1. When you use that query and do not have an index on the Date column, SQLite will read all records from the table, and use a temporary table to sort the result.
    2. When you have an index on the Date column, SQLite will look up the last 100 records in the index, then read all the data of those records from the table.
    3. When you have a covering index, i.e., one index with the four columns Date, State, ProductId, and ProductName, SQLite will just read the last 100 entries from the index.

    Whenever SQLite reads from the database file, it does not read values or records, but entire pages (typically, 1 KB or 4 KB).

    In case 1, SQLite will read all pages of the table.
    In case 2, SQLite will read the last page of the index (because the 100 dates will fit into one page), and 100 pages of the table (one for each record, assuming that no two of these records happen to be in the same page).
    In case 3, SQLite will read the last few pages of the index.

    Case 2 will be much faster than case 1; case 3 will be faster still, but probably not enough to be noticeable.

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

Sidebar

Related Questions

I have one table called: Transaction. This table has the following fields: (ID,ProductName,Amount,Date) placed
Consider the following table which has the fields - id (int) and date_created (datetime):
my table has the following fields videos |id| |average| |views| now i select some
I have a table in db2 which has the following fields int xyz; string
I have a table that has multiple rows with the following fields: PersonName SongName
Imagine the following database: Table 'companies' has fields id, name and flagship_product_id. Table 'products'
Table has the following info: date |vendor|sales|percent| -------------------------- 2009-03-03| 10 |13.50| 1.30 | 2009-03-10|
My SAMPLE table has the following five columns: sample_id (PK) (NUMBER) sampled_on (DATE) received_on
I have a table that has the following fields: 1- Name 2- Dept 3-
Hi all I have an appointments table that has among other fields a DATE

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.