Documentation Source Text

Check-in [bc47f60abd]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add details to the page_size pragma, including specification of the page size selection algorithm.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: bc47f60abdfb2e86b7c8b7f40231833e43879735
User & Date: drh 2008-04-29 13:10:56.000
Context
2008-04-29
13:18
Use SQLITE_DEFAULT_PAGE_SIZE instead of 1024 in the page size algorithm. (check-in: c4bd8f4f26 user: drh tags: trunk)
13:10
Add details to the page_size pragma, including specification of the page size selection algorithm. (check-in: bc47f60abd user: drh tags: trunk)
2008-04-27
17:51
Updates to the SQL language documentation with many added hyperlink targets. (check-in: f060763119 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to pages/pragma.in.
371
372
373
374
375
376
377
378
379
380
381
382
383
384





























385
386
387
388
389
390
391
   be changed.  All other databases use the normal locking mode by default
   and are affected by this pragma.</p>
</li>

<tcl>Subsection page_size</tcl>
<li><p><b>PRAGMA page_size;
       <br>PRAGMA page_size = </b><i>bytes</i><b>;</b></p>
    <p>Query or set the page-size of the database. The page-size
    may only be set if the database has not yet been created. The page
    size must be a power of two greater than or equal to 512 and less
    than or equal to 8192. The upper limit may be modified by setting
    the value of macro SQLITE_MAX_PAGE_SIZE during compilation.  The
    maximum upper bound is 32768.
    </p>





























</li>

<tcl>Subsection max_page_count</tcl>
<li><p><b>PRAGMA max_page_count;
       <br>PRAGMA max_page_count = </b><i>N</i><b>;</b></p>
    <p>Query or set the maximum number of pages in the database file.
    Both forms of the pragma return the maximum page count.  The second







|


|
|
<

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







371
372
373
374
375
376
377
378
379
380
381
382

383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
   be changed.  All other databases use the normal locking mode by default
   and are affected by this pragma.</p>
</li>

<tcl>Subsection page_size</tcl>
<li><p><b>PRAGMA page_size;
       <br>PRAGMA page_size = </b><i>bytes</i><b>;</b></p>
    <p>Query or set the page size of the database. The page size
    may only be set if the database has not yet been created. The page
    size must be a power of two greater than or equal to 512 and less
    than or equal to [SQLITE_MAX_PAGE_SIZE].
    The maximum value for [SQLITE_MAX_PAGE_SIZE] is 32768.

    </p>

    <p>When a new database is created, SQLite assigned a default page size
    based on information received from the xSectorSize and 
    xDeviceCharacteristics methods of the [sqlite3_io_methods] object
    of the newly created database file.  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.  As of [version 3.5.8], 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.</p>

    <p>If SQLite is compiled with the SQLITE_ENABLE_ATOMIC_WRITE option,
    then the default page size is chosen to be the largest page size
    less than or equal to SQLITE_MAX_DEFAULT_PAGE_SIZE for which atomic
    write is enabled according to the
    xDeviceCharacteristics method of the [sqlite3_io_methods] object for
    the database file.  If the SQLITE_ENABLE_ATOMIC_WRITE option is
    disabled or if xDeviceCharacteristics reports no suitable atomic
    write page sizes, then the default page size is the larger of 1024
    and the sector size as reported by the xSectorSize method of the
    [sqlite3_io_methods] object, but not more than 
    SQLITE_MAX_DEFAULT_PAGE_SIZE.  The default configuration for SQLite
    running on workstations is for atomic write to be
    disabled, for the maximum page size to be set to 32768, and for the
    maximum default page size to be set to 8192.  The default xSectorSize
    method on workstation implementations always reports a sector size
    of 512 bytes.  Hence, 
    the default page size chosen by SQLite is usually 1024 bytes.</p>
</li>

<tcl>Subsection max_page_count</tcl>
<li><p><b>PRAGMA max_page_count;
       <br>PRAGMA max_page_count = </b><i>N</i><b>;</b></p>
    <p>Query or set the maximum number of pages in the database file.
    Both forms of the pragma return the maximum page count.  The second