SlideShare une entreprise Scribd logo
1  sur  26
Télécharger pour lire hors ligne
An illustrated guide to
  the buffer cache
               Selena Deckelmann
  Based on Greg Smith’s “Inside the Buffer Cache”
http://www.westnet.com/∼gsmith/content/postgresql
Table

Databases                        Table


                                 Table



     Databases are made of tables...
$PGDATA/base/                 Table




    A table is just a directory...
$PGDATA/base/               Table


                            Table

                            Table


  You can have more than one table.
$PGDATA/base/   Table

                Table

                Table   Made of           Made o
                                                   f          8K
                                  File                        8K
                                                              8K
                                  File
                                                              8K
                                                              8K
                                  File
                                                              8K
                                  File                        8K
                                                              ...
                                   ...                 Up to 1 GB

                Files are made up of 8K blocks.*

                                                         * you can change that at compile time.
shared_buffers
shared_buffers

       ptr   ptr   ptr   ptr   ptr   ...

      An array of pointers to 8K blocks
           (and some other stuff)

shared_buffers is configured at database start.
  You have to restart Postgres to change it.
shared_buffers:
 the other stuff
FREE FREE FREE FREE FREE FREE



       In the beginning...
shared_buffers:
 the other stuff
FREE FREE FREE FREE FREE FREE
 456  12   100 612   32   409
shared_buffers:
the other stuff
 X    X     X     X    X     X
456   12   100   612   32   409
shared_buffers:
         the other stuff
         X         X         X         X         X         X
Tag   base/file1 base/file2 base/file1 base/file3 base/file1 base/file1

       456        12       100       612        32       409
shared_buffers:
            the other stuff
            X         X         X         X         X         X
  Tag    base/file1 base/file2 base/file1 base/file3 base/file1 base/file1

          456        12       100       612        32       409
Status   FLAGS FLAGS FLAGS FLAGS FLAGS FLAGS
shared_buffers:
            the other stuff
            X         X         X         X         X         X
  Tag    base/file1 base/file2 base/file1 base/file3 base/file1 base/file1

          456        12       100       612        32       409
Status   PINNED     flags      flags      flags      flags      flags




                    {                                                  }
                           UPDATE mytable (status)
                           VALUES(‘my cat is the best ever’)
                           where user = ‘selenamarie’;
shared_buffers:
            the other stuff
            X         X         X         X         X         X
  Tag    base/file1 base/file2 base/file1 base/file3 base/file1 base/file1

          456        12       100       612        32       409
Status   PINNED    DIRTY flags           flags      flags      flags




                                  {     COMMIT;
                                                                       }
shared_buffers:
            the other stuff
            X         X         X         X         X         X
  Tag    base/file1 base/file2 base/file1 base/file3 base/file1 base/file1

          456        12       100       612        32       409
Status   PINNED    DIRTY OTHER OTHER OTHER OTHER




                                           {     BLAH BLAH BLAH;
                                                                       }
shared_buffers:
            the other stuff
            X         X         X         X         X         X
  Tag    base/file1 base/file2 base/file1 base/file3 base/file1 base/file1

          456        12       100       612        32       409
Status   PINNED    DIRTY OTHER OTHER OTHER OTHER
Usage       1        5     5     4     3     0
shared_buffers:
     the lifecycle
   X         X         X         X         X         X
base/file1 base/file2 base/file1 base/file3 base/file1 base/file1

 456        12       100       612        32       409
PINNED    DIRTY OTHER OTHER OTHER OTHER
   1        5     5     4     3     0



           {      myPgProcess calls:
                  BufferAlloc(‘base/file1’, 100);              }
shared_buffers:
     the lifecycle
   X         X         X         X         X         X
base/file1 base/file2 base/file1 base/file3 base/file1 base/file1

 456        12       100       612        32       409
PINNED    DIRTY     PINNED    OTHER OTHER OTHER
   1        5          5         4         3         0



           {      myPgProcess calls:
                  BufferAlloc(‘base/file1’, 100);              }
shared_buffers:
     the lifecycle
   X         X         X         X         X         X
base/file1 base/file2 base/file1 base/file3 base/file1 base/file1

 456        12       100       612        32       409
PINNED    DIRTY OTHER OTHER OTHER OTHER
   1        5     5     4     3     0



           {      myPgProcess calls:
                  BufferAlloc(‘base/file1’, 101);              }
shared_buffers:
                 the lifecycle
                      Who’s it gonna be?
               X         X         X         X         X         X
            base/file1 base/file2 base/file1 base/file3 base/file1 base/file1

             456        12       100       612        32       409
            PINNED    DIRTY OTHER OTHER OTHER OTHER
               1        5     5     4     3     0


Eviction!              {      myPgProcess calls:
                              BufferAlloc(‘base/file1’, 101);              }
shared_buffers:
                the lifecycle
                     Who’s it gonna be?
              X         X         X         X         X         X
           base/file1 base/file2 base/file1 base/file3 base/file1 base/file1

            456        12       100       612        32       409
           PINNED    DIRTY OTHER OTHER OTHER OTHER
              0        5     5     4     3     0

Scan the cache!
  Usage != 0,
so decrement.
                      {      myPgProcess calls:
                             BufferAlloc(‘base/file1’, 101);              }
shared_buffers:
     the lifecycle
          Who’s it gonna be?
   X         X         X         X         X         X
base/file1 base/file2 base/file1 base/file3 base/file1 base/file1   Usage == 0,
 456        12       100       612        32       409         Goodbye!
PINNED    DIRTY OTHER OTHER OTHER OTHER
   0        4     4     3     2     0



           {      myPgProcess calls:
                  BufferAlloc(‘base/file1’, 101);                      }
shared_buffers:
     the lifecycle
          Who’s it gonna be?
   X         X         X         X         X         X
base/file1 base/file2 base/file1 base/file3 base/file1 base/file1

 456        12       100       612        32       101
PINNED    DIRTY OTHER OTHER OTHER                 PINNED

   0        4     4     3     2                      1



           {      myPgProcess calls:
                  BufferAlloc(‘base/file1’, 101);              }
shared_buffers:
                   optimizations*
         X         X         X         X         X         X         X         ...
      base/file1 base/file2 base/file1 base/file3 base/file1 base/file1 base/file2    ...

       456        12       100       612        32       101       891         ...
      PINNED    DIRTY OTHER OTHER OTHER PINNED OTHER                           ...
         0        4     4     3     2      0     1                             ...



                           {                                                              }
Result is greater
      than:                       SELECT pg_relation_size(‘mytable’);
shared_buffers/4                  VACUUM mytable;
                                                                       * Version 8.3 and later
shared_buffers:
                    optimizations
         X         X         X         X         X         X         X         ...
      base/file1 base/file2 base/file1 base/file3 base/file1 base/file1 base/file2    ...

        456       12       100       612        32       101       891         ...
      PINNED    DIRTY OTHER OTHER OTHER PINNED OTHER                           ...
         0        4     4     3     2      0     1                             ...



   256K ring
buffer allocated!
                           {      SELECT pg_relation_size(‘mytable’);
                                  VACUUM mytable;                                         }
                                                                       * Version 8.3 and later
shared_buffers:
                    optimizations VACUUM
                                  Safe during

        OVERSIMPLIFICATION WARNING!
         X         X         X         X         X         X         X         ...
      base/file1 base/file2 base/file1 base/file3 base/file1 base/file1 base/file2    ...

        456       12       100       612        32       101       891         ...
      PINNED    DIRTY OTHER OTHER OTHER PINNED OTHER                           ...
         0        4     4     3     2      0     1                             ...



   256K ring
buffer allocated!
                           {      SELECT pg_relation_size(‘mytable’);
                                  VACUUM mytable;                                         }
                                                                       * Version 8.3 and later

Contenu connexe

En vedette

Martin karlssons vykortssamling sigtunastiftelsen
Martin karlssons vykortssamling   sigtunastiftelsenMartin karlssons vykortssamling   sigtunastiftelsen
Martin karlssons vykortssamling sigtunastiftelsen
hembygdsigtuna
 
Martin karlssons vykortssamling flygfoton
Martin karlssons vykortssamling   flygfotonMartin karlssons vykortssamling   flygfoton
Martin karlssons vykortssamling flygfoton
hembygdsigtuna
 
2009 Meet The Principal
2009 Meet The Principal2009 Meet The Principal
2009 Meet The Principal
ph0enix74
 

En vedette (12)

Martin karlssons vykortssamling sigtunastiftelsen
Martin karlssons vykortssamling   sigtunastiftelsenMartin karlssons vykortssamling   sigtunastiftelsen
Martin karlssons vykortssamling sigtunastiftelsen
 
Measuring Social Media For B2B
Measuring Social Media For B2BMeasuring Social Media For B2B
Measuring Social Media For B2B
 
Martin karlssons vykortssamling flygfoton
Martin karlssons vykortssamling   flygfotonMartin karlssons vykortssamling   flygfoton
Martin karlssons vykortssamling flygfoton
 
Arduino yun × apiで遊んでみる
Arduino yun × apiで遊んでみるArduino yun × apiで遊んでみる
Arduino yun × apiで遊んでみる
 
Christmas is for Cookies
Christmas is for CookiesChristmas is for Cookies
Christmas is for Cookies
 
Securing Business: Strategic Enablement of Users
Securing Business: Strategic Enablement of UsersSecuring Business: Strategic Enablement of Users
Securing Business: Strategic Enablement of Users
 
Chrome拡張開発者のためのFirefox拡張開発
Chrome拡張開発者のためのFirefox拡張開発Chrome拡張開発者のためのFirefox拡張開発
Chrome拡張開発者のためのFirefox拡張開発
 
Product Management: Site & Situation
Product Management: Site & SituationProduct Management: Site & Situation
Product Management: Site & Situation
 
2009 Meet The Principal
2009 Meet The Principal2009 Meet The Principal
2009 Meet The Principal
 
The teacher librarian as resource creator: Developing learning websites
The teacher librarian as resource creator: Developing learning websitesThe teacher librarian as resource creator: Developing learning websites
The teacher librarian as resource creator: Developing learning websites
 
プッシュからデータ保存まで。アプリ開発でニフティクラウド mobile backendを使う上での良くある質問、疑問にお答えします
プッシュからデータ保存まで。アプリ開発でニフティクラウド mobile backendを使う上での良くある質問、疑問にお答えしますプッシュからデータ保存まで。アプリ開発でニフティクラウド mobile backendを使う上での良くある質問、疑問にお答えします
プッシュからデータ保存まで。アプリ開発でニフティクラウド mobile backendを使う上での良くある質問、疑問にお答えします
 
Prietenior Mei...
Prietenior Mei...Prietenior Mei...
Prietenior Mei...
 

Plus de Selena Deckelmann

While we're here, let's fix computer science education
While we're here, let's fix computer science educationWhile we're here, let's fix computer science education
While we're here, let's fix computer science education
Selena Deckelmann
 
Mistakes were made - LCA 2012
Mistakes were made - LCA 2012Mistakes were made - LCA 2012
Mistakes were made - LCA 2012
Selena Deckelmann
 
Harder, better, faster, stronger: PostgreSQL 9.1
Harder, better, faster, stronger: PostgreSQL 9.1Harder, better, faster, stronger: PostgreSQL 9.1
Harder, better, faster, stronger: PostgreSQL 9.1
Selena Deckelmann
 
Own it: working with a changing open source community
Own it: working with a changing open source communityOwn it: working with a changing open source community
Own it: working with a changing open source community
Selena Deckelmann
 
Managing terabytes: When Postgres gets big
Managing terabytes: When Postgres gets bigManaging terabytes: When Postgres gets big
Managing terabytes: When Postgres gets big
Selena Deckelmann
 

Plus de Selena Deckelmann (20)

While we're here, let's fix computer science education
While we're here, let's fix computer science educationWhile we're here, let's fix computer science education
While we're here, let's fix computer science education
 
Algorithms are Recipes
Algorithms are RecipesAlgorithms are Recipes
Algorithms are Recipes
 
Hire the right way
Hire the right wayHire the right way
Hire the right way
 
Mistakes were made - LCA 2012
Mistakes were made - LCA 2012Mistakes were made - LCA 2012
Mistakes were made - LCA 2012
 
Pg92 HA, LCA 2012, Ballarat
Pg92 HA, LCA 2012, BallaratPg92 HA, LCA 2012, Ballarat
Pg92 HA, LCA 2012, Ballarat
 
Managing terabytes
Managing terabytesManaging terabytes
Managing terabytes
 
Mistakes were made
Mistakes were madeMistakes were made
Mistakes were made
 
Postgres needs an aircraft carrier
Postgres needs an aircraft carrierPostgres needs an aircraft carrier
Postgres needs an aircraft carrier
 
Mistakes were made
Mistakes were madeMistakes were made
Mistakes were made
 
Harder, better, faster, stronger: PostgreSQL 9.1
Harder, better, faster, stronger: PostgreSQL 9.1Harder, better, faster, stronger: PostgreSQL 9.1
Harder, better, faster, stronger: PostgreSQL 9.1
 
How to ask for money
How to ask for moneyHow to ask for money
How to ask for money
 
Letters from the open source trenches - Postgres community
Letters from the open source trenches - Postgres communityLetters from the open source trenches - Postgres community
Letters from the open source trenches - Postgres community
 
Own it: working with a changing open source community
Own it: working with a changing open source communityOwn it: working with a changing open source community
Own it: working with a changing open source community
 
Managing terabytes: When Postgres gets big
Managing terabytes: When Postgres gets bigManaging terabytes: When Postgres gets big
Managing terabytes: When Postgres gets big
 
Managing terabytes: When PostgreSQL gets big
Managing terabytes: When PostgreSQL gets bigManaging terabytes: When PostgreSQL gets big
Managing terabytes: When PostgreSQL gets big
 
Pdxpugday2010 pg90
Pdxpugday2010 pg90Pdxpugday2010 pg90
Pdxpugday2010 pg90
 
Making Software Communities
Making Software CommunitiesMaking Software Communities
Making Software Communities
 
Bucardo
BucardoBucardo
Bucardo
 
How a bunch of normal people Used Technology To Repair a Rigged Election
How a bunch of normal people Used Technology To Repair a Rigged ElectionHow a bunch of normal people Used Technology To Repair a Rigged Election
How a bunch of normal people Used Technology To Repair a Rigged Election
 
Open Source Bridge Opening Day
Open Source Bridge Opening DayOpen Source Bridge Opening Day
Open Source Bridge Opening Day
 

Dernier

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Dernier (20)

Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 

Illustrated buffer cache

  • 1. An illustrated guide to the buffer cache Selena Deckelmann Based on Greg Smith’s “Inside the Buffer Cache” http://www.westnet.com/∼gsmith/content/postgresql
  • 2. Table Databases Table Table Databases are made of tables...
  • 3. $PGDATA/base/ Table A table is just a directory...
  • 4. $PGDATA/base/ Table Table Table You can have more than one table.
  • 5. $PGDATA/base/ Table Table Table Made of Made o f 8K File 8K 8K File 8K 8K File 8K File 8K ... ... Up to 1 GB Files are made up of 8K blocks.* * you can change that at compile time.
  • 7. shared_buffers ptr ptr ptr ptr ptr ... An array of pointers to 8K blocks (and some other stuff) shared_buffers is configured at database start. You have to restart Postgres to change it.
  • 8. shared_buffers: the other stuff FREE FREE FREE FREE FREE FREE In the beginning...
  • 9. shared_buffers: the other stuff FREE FREE FREE FREE FREE FREE 456 12 100 612 32 409
  • 10. shared_buffers: the other stuff X X X X X X 456 12 100 612 32 409
  • 11. shared_buffers: the other stuff X X X X X X Tag base/file1 base/file2 base/file1 base/file3 base/file1 base/file1 456 12 100 612 32 409
  • 12. shared_buffers: the other stuff X X X X X X Tag base/file1 base/file2 base/file1 base/file3 base/file1 base/file1 456 12 100 612 32 409 Status FLAGS FLAGS FLAGS FLAGS FLAGS FLAGS
  • 13. shared_buffers: the other stuff X X X X X X Tag base/file1 base/file2 base/file1 base/file3 base/file1 base/file1 456 12 100 612 32 409 Status PINNED flags flags flags flags flags { } UPDATE mytable (status) VALUES(‘my cat is the best ever’) where user = ‘selenamarie’;
  • 14. shared_buffers: the other stuff X X X X X X Tag base/file1 base/file2 base/file1 base/file3 base/file1 base/file1 456 12 100 612 32 409 Status PINNED DIRTY flags flags flags flags { COMMIT; }
  • 15. shared_buffers: the other stuff X X X X X X Tag base/file1 base/file2 base/file1 base/file3 base/file1 base/file1 456 12 100 612 32 409 Status PINNED DIRTY OTHER OTHER OTHER OTHER { BLAH BLAH BLAH; }
  • 16. shared_buffers: the other stuff X X X X X X Tag base/file1 base/file2 base/file1 base/file3 base/file1 base/file1 456 12 100 612 32 409 Status PINNED DIRTY OTHER OTHER OTHER OTHER Usage 1 5 5 4 3 0
  • 17. shared_buffers: the lifecycle X X X X X X base/file1 base/file2 base/file1 base/file3 base/file1 base/file1 456 12 100 612 32 409 PINNED DIRTY OTHER OTHER OTHER OTHER 1 5 5 4 3 0 { myPgProcess calls: BufferAlloc(‘base/file1’, 100); }
  • 18. shared_buffers: the lifecycle X X X X X X base/file1 base/file2 base/file1 base/file3 base/file1 base/file1 456 12 100 612 32 409 PINNED DIRTY PINNED OTHER OTHER OTHER 1 5 5 4 3 0 { myPgProcess calls: BufferAlloc(‘base/file1’, 100); }
  • 19. shared_buffers: the lifecycle X X X X X X base/file1 base/file2 base/file1 base/file3 base/file1 base/file1 456 12 100 612 32 409 PINNED DIRTY OTHER OTHER OTHER OTHER 1 5 5 4 3 0 { myPgProcess calls: BufferAlloc(‘base/file1’, 101); }
  • 20. shared_buffers: the lifecycle Who’s it gonna be? X X X X X X base/file1 base/file2 base/file1 base/file3 base/file1 base/file1 456 12 100 612 32 409 PINNED DIRTY OTHER OTHER OTHER OTHER 1 5 5 4 3 0 Eviction! { myPgProcess calls: BufferAlloc(‘base/file1’, 101); }
  • 21. shared_buffers: the lifecycle Who’s it gonna be? X X X X X X base/file1 base/file2 base/file1 base/file3 base/file1 base/file1 456 12 100 612 32 409 PINNED DIRTY OTHER OTHER OTHER OTHER 0 5 5 4 3 0 Scan the cache! Usage != 0, so decrement. { myPgProcess calls: BufferAlloc(‘base/file1’, 101); }
  • 22. shared_buffers: the lifecycle Who’s it gonna be? X X X X X X base/file1 base/file2 base/file1 base/file3 base/file1 base/file1 Usage == 0, 456 12 100 612 32 409 Goodbye! PINNED DIRTY OTHER OTHER OTHER OTHER 0 4 4 3 2 0 { myPgProcess calls: BufferAlloc(‘base/file1’, 101); }
  • 23. shared_buffers: the lifecycle Who’s it gonna be? X X X X X X base/file1 base/file2 base/file1 base/file3 base/file1 base/file1 456 12 100 612 32 101 PINNED DIRTY OTHER OTHER OTHER PINNED 0 4 4 3 2 1 { myPgProcess calls: BufferAlloc(‘base/file1’, 101); }
  • 24. shared_buffers: optimizations* X X X X X X X ... base/file1 base/file2 base/file1 base/file3 base/file1 base/file1 base/file2 ... 456 12 100 612 32 101 891 ... PINNED DIRTY OTHER OTHER OTHER PINNED OTHER ... 0 4 4 3 2 0 1 ... { } Result is greater than: SELECT pg_relation_size(‘mytable’); shared_buffers/4 VACUUM mytable; * Version 8.3 and later
  • 25. shared_buffers: optimizations X X X X X X X ... base/file1 base/file2 base/file1 base/file3 base/file1 base/file1 base/file2 ... 456 12 100 612 32 101 891 ... PINNED DIRTY OTHER OTHER OTHER PINNED OTHER ... 0 4 4 3 2 0 1 ... 256K ring buffer allocated! { SELECT pg_relation_size(‘mytable’); VACUUM mytable; } * Version 8.3 and later
  • 26. shared_buffers: optimizations VACUUM Safe during OVERSIMPLIFICATION WARNING! X X X X X X X ... base/file1 base/file2 base/file1 base/file3 base/file1 base/file1 base/file2 ... 456 12 100 612 32 101 891 ... PINNED DIRTY OTHER OTHER OTHER PINNED OTHER ... 0 4 4 3 2 0 1 ... 256K ring buffer allocated! { SELECT pg_relation_size(‘mytable’); VACUUM mytable; } * Version 8.3 and later