Skip to content

PRAGMA page_size has no effect, and SQLITE_DEFAULT_PAGE_SIZE 512 has no effect. #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
trianglesis opened this issue May 21, 2025 · 9 comments

Comments

@trianglesis
Copy link

Hello,
As described at this issue post: siara-cc/esp32_arduino_sqlite3_lib#92 (comment)

I'm trying to reduce SQLite's memory footprint by lowering the page size, but this command or definition has no effect.

Hello,

Can you please point me in the right direction? I'm having issues with setting page_size:

I'm using two approaches, neither of which is working. As soon as the database is created, and I'm checking it in DB Browser (downloaded from ESP32 via file server to my PC), it shows page_size 4096

1. Set `#define SQLITE_DEFAULT_PAGE_SIZE 512` at the header of my SQL driver file, where I include `#include "sqlite3.h"` and `#include "sqllib.h"`, later I can see `#define SQLITE_DEFAULT_PAGE_SIZE 512` in `managed_components\nopnop2002__sqlite3\config_ext.h` file, which is fine.

2. Set the query: `PRAGMA page_size=512; VACUUM;` as soon as the newly created DB is opened, before any table creation.
   Literally: `rc = db_query(xMessageBufferQuery, db, "PRAGMA page_size=512; VACUUM;");`

I was trying actually delete the file via file browser and programmatically with unlink(db_name); - right before init.

And no effect.

PRAGMA main.page_size = 1024;
PRAGMA main.page_size;

Image

Image

The author of the original lib says he changed page_size some time ago: siara-cc/esp32_arduino_sqlite3_lib#92 (comment)

@trianglesis trianglesis changed the title PPAGMA page_size has no effect, and SQLITE_DEFAULT_PAGE_SIZE 512 has no effect. PRAGMA page_size has no effect, and SQLITE_DEFAULT_PAGE_SIZE 512 has no effect. May 21, 2025
@nopnop2002
Copy link
Owner

nopnop2002 commented May 21, 2025

The author of the original lib says he changed page_size some time ago: siara-cc/esp32_arduino_sqlite3_lib#92 (comment)

This is for the Arduino environment, not the ESP-IDF environment.

This repository is for the ESP-IDF environment.

Your PR to fix this issue is welcome.

@trianglesis
Copy link
Author

You mentioned your fork is only optimised for the building procedure for IDF.

Although it is a very nice library, it cannot be built with ESP-IDF Ver5.
Therefore, We changed it so that it can also be used with ESP-IDF Ver5.

It now looks like the library is poorly ported to IDF.
Please add a note to the README file stating that this fork has many limitations and non-working features.

@nopnop2002
Copy link
Owner

nopnop2002 commented May 22, 2025

The original is here.

We believe this fork functions exactly the same as the original.
The defects present in the original are also present in this fork.

Please check if this issue exists in the original.

@trianglesis
Copy link
Author

trianglesis commented May 22, 2025

The original is here.

If the original has been fixed, we will correct it here too.

The original is not broken; the fork is.

This has no effect: https://github.com/nopnop2002/esp32-idf-sqlite3/blame/a27228d70b9bcf92149a28e7ea490661f9a9ca4d/components/esp32-idf-sqlite3/config_ext.h#L23

The original: siara-cc/esp32_arduino_sqlite3_lib#92 (comment)

@nopnop2002
Copy link
Owner

nopnop2002 commented May 22, 2025

siara-cc/esp32_arduino_sqlite3_lib#92 (comment)

This is NOT original.

The original of this fork is here.

@trianglesis
Copy link
Author

Here is the original maintainer siara-cc explaining the SQLITE_DEFAULT_PAGE_SIZE directive: siara-cc/esp32_arduino_sqlite3_lib#92 (comment)

Please read carefully.

This directive SQLITE_DEFAULT_PAGE_SIZE has no effect in your fork.
Please update the README file, adding the features that do not work.

@nopnop2002
Copy link
Owner

nopnop2002 commented May 22, 2025

The original version of this fork can be found here.
https://github.com/siara-cc/esp32-idf-sqlite3

No code has been changed from the original.

I only added an example and changed Make to Cmake.

This directive SQLITE_DEFAULT_PAGE_SIZE has no effect in your fork.

This directive SQLITE_DEFAULT_PAGE_SIZE has no effect in ORIGINAL.

@trianglesis
Copy link
Author

The original version of this fork can be found here. https://github.com/siara-cc/esp32-idf-sqlite3

No code has been changed from the original.

I only added an example and changed Make to Cmake.

This directive SQLITE_DEFAULT_PAGE_SIZE has no effect in your fork.

This directive SQLITE_DEFAULT_PAGE_SIZE has no effect in ORIGINAL.

So, updating the README file will help people understand the library's supported level.
It can save a few days in troubleshooting.

@nopnop2002
Copy link
Owner

I added this to README.

If there is a issues in the original, the same issues will be found in this repository.
If you find any issues, we welcome your PR to resolve them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants