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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:47:01+00:00 2026-05-26T06:47:01+00:00

I have a SQlite3 table that has typeless columns like in this example: CREATE

  • 0

I have a SQlite3 table that has typeless columns like in this example:

CREATE TABLE foo(
  Timestamp INT NOT NULL,
  SensorID,
  Value,
  PRIMARY KEY(Timestamp, SensorID)
);

I have specific reasons not to declare the type of the columns SensorID and Value.
When inserting rows with numeric SensorID and Value columns I notice that they are being written as plain text into the .db file.

When I change the CREATE TABLE statement to…

CREATE TABLE foo(
  Timestamp INT NOT NULL,
  SensorID INT,
  Value REAL,
  PRIMARY KEY(Timestamp, SensorID)
);

…then the values seem to be written in some binary format to the .db file.

Since I need to write several millions of rows to the database, I have concerns about the file size this data produces and so would like to avoid value storage in plain text form.

Can I force SQLite to use binary representation in it’s database file without using explicitly typed columns?

Note: Rows are currently written with PHP::PDO using prepared statements.

  • 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-26T06:47:02+00:00Added an answer on May 26, 2026 at 6:47 am

    The example in section 3.4 in the sqlite docs about types demonstrates the insertion of a number as int in a column without an explicit declaration of type. I guess the trick is leaving out the quotes around the number, which would convert it to a string (which, in the case of typed columns, would be coerced back into a number).

    Section 2 in the page linked above also provides a lot of info about the type conversions taking place.

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

Sidebar

Related Questions

I have a table that has a column with the timestamp in sqlite3. It
I have data in an SQLite table that looks like this: user_id event_date ----------
I have the following table in a SQLite3 database: CREATE TABLE overlap_results ( neighbors_of_annotation
I have a sqlite (v3) table with this column definition: timestamp DATETIME DEFAULT CURRENT_TIMESTAMP
I have a table in SQLite: CREATE TABLE test_results(timestamp TEXT, npass INTEGER, nfails INTEGER)
I have a Sqlite database that has a table consisting of company information (Companies)
I have a sqlite3 table. One of the columns is a varchar(12). The issue:
I have some code in my application that looks something like this: char *hash
hi to all i have a table that is named books and it has
I have a sqlite table that has amount field with NUMERIC(10,5) value(I know data

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.