How to modify page_size

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

How to modify page_size

Jim Wang
hi,all
     How could I modify the page_size of the Data base? I use the following method, but could not change the page_size.
      nRet = sqlite3_exec(m_pDB, "PRAGMA page_size=8192;", 0,0,&pzErrMsg);
     Why?
   
     best regards.
        Jim Wang.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: How to modify page_size

Clemens Ladisch
Jim Wang wrote:
> How could I modify the page_size of the Data base?

The documentation <http://www.sqlite.org/pragma.html#pragma_page_size>
says:
| The page_size pragma will only cause an immediate change in the page
| size if it is issued while the database is still empty, prior to the
| first CREATE TABLE statement. If the page_size pragma is used to
| specify a new page size just prior to running the VACUUM command ...
| then VACUUM will change the page size to the new value.


Regards,
Clemens
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: How to modify page_size

Hick Gunter
In reply to this post by Jim Wang
Short answer: you can't. It would require rebuilding every single page of the database.

Exception 1: If the database is empty, the pragma will set the page size.

Exception 2: If your database is not empty and you run VACUUM (which rebuilds every page of the database anyway) immediately after issuing the pragma.

-----Ursprüngliche Nachricht-----
Von: [hidden email] [mailto:[hidden email]] Im Auftrag von Jim Wang
Gesendet: Donnerstag, 25. Februar 2016 08:40
An: [hidden email]
Betreff: [sqlite] How to modify page_size

hi,all
     How could I modify the page_size of the Data base? I use the following method, but could not change the page_size.
      nRet = sqlite3_exec(m_pDB, "PRAGMA page_size=8192;", 0,0,&pzErrMsg);
     Why?

     best regards.
        Jim Wang.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


___________________________________________
 Gunter Hick
Software Engineer
Scientific Games International GmbH
FN 157284 a, HG Wien
Klitschgasse 2-4, A-1130 Vienna, Austria
Tel: +43 1 80100 0
E-Mail: [hidden email]

This communication (including any attachments) is intended for the use of the intended recipient(s) only and may contain information that is confidential, privileged or legally protected. Any unauthorized use or dissemination of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the sender by return e-mail message and delete all copies of the original communication. Thank you for your cooperation.


_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: How to modify page_size

R Smith
In reply to this post by Jim Wang


On 2016/02/25 9:40 AM, Jim Wang wrote:
> hi,all
>       How could I modify the page_size of the Data base? I use the following method, but could not change the page_size.
>        nRet = sqlite3_exec(m_pDB, "PRAGMA page_size=8192;", 0,0,&pzErrMsg);
>       Why?

Because the Pragma specifies the ideal, it doesn't make the change.

Follow that up with a "VACUUM;" to make the change and re-pack the DB file.



_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: How to modify page_size

YONGIL JANG
AFAIK, WAL mode is used and database is not empty, VACUUM operation doesn't
change page size.

But, I'm not sure about latest version of SQLite. :)

2016년 2월 25일 (목) 16:50, R Smith <[hidden email]>님이 작성:

>
>
> On 2016/02/25 9:40 AM, Jim Wang wrote:
> > hi,all
> >       How could I modify the page_size of the Data base? I use the
> following method, but could not change the page_size.
> >        nRet = sqlite3_exec(m_pDB, "PRAGMA page_size=8192;",
> 0,0,&pzErrMsg);
> >       Why?
>
> Because the Pragma specifies the ideal, it doesn't make the change.
>
> Follow that up with a "VACUUM;" to make the change and re-pack the DB file.
>
>
>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: How to modify page_size

Hick Gunter
Works as advertised. A database in WAL mode does not allow the page size to be changed.

-----Ursprüngliche Nachricht-----
Von: [hidden email] [mailto:[hidden email]] Im Auftrag von Yongil Jang
Gesendet: Donnerstag, 25. Februar 2016 09:19
An: SQLite mailing list
Betreff: Re: [sqlite] How to modify page_size

AFAIK, WAL mode is used and database is not empty, VACUUM operation doesn't change page size.

But, I'm not sure about latest version of SQLite. :)

2016년 2월 25일 (목) 16:50, R Smith <[hidden email]>님이 작성:

>
>
> On 2016/02/25 9:40 AM, Jim Wang wrote:
> > hi,all
> >       How could I modify the page_size of the Data base? I use the
> following method, but could not change the page_size.
> >        nRet = sqlite3_exec(m_pDB, "PRAGMA page_size=8192;",
> 0,0,&pzErrMsg);
> >       Why?
>
> Because the Pragma specifies the ideal, it doesn't make the change.
>
> Follow that up with a "VACUUM;" to make the change and re-pack the DB file.
>
>
>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


___________________________________________
 Gunter Hick
Software Engineer
Scientific Games International GmbH
FN 157284 a, HG Wien
Klitschgasse 2-4, A-1130 Vienna, Austria
Tel: +43 1 80100 0
E-Mail: [hidden email]

This communication (including any attachments) is intended for the use of the intended recipient(s) only and may contain information that is confidential, privileged or legally protected. Any unauthorized use or dissemination of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the sender by return e-mail message and delete all copies of the original communication. Thank you for your cooperation.


_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: How to modify page_size

LincolnBurrows
This post has NOT been accepted by the mailing list yet.
In reply to this post by Clemens Ladisch
The page_size pragma will only cause an immediate change in the page size if it is issued while the database is still empty, prior to the first CREATE TABLE statement. If the page_size pragma is used to specify a new page size just prior to running the VACUUM command and if the database is not in WAL journal mode then VACUUM will change the page size to the new value.