Giter Site home page Giter Site logo

Show heap fetches as percent % about pev2 HOT 2 OPEN

pgiraud avatar pgiraud commented on August 14, 2024
Show heap fetches as percent %

from pev2.

Comments (2)

Krysztophe avatar Krysztophe commented on August 14, 2024

The % of blocks is perhaps more important, but you can't have that.

The threshold should be rather low. A rather small proportion is already the sign that you need a VACUUM.

I hope to find time to test soon.

from pev2.

Krysztophe avatar Krysztophe commented on August 14, 2024

I confirm: a few percent of heap fetches is already a disaster.

Examples (in the worst case: old computer, default configuration, not enough RAM, slow HDD) :

  • clean table after an INSERT, vacuumed:
                                                     QUERY PLAN                                                      
═════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
 Index Only Scan using demoheapfetches_i_j_idx on demoheapfetches (actual time=0.984..1477.217 rows=1000000 loops=1)
   Heap Fetches: 0
   Buffers: shared hit=601242 read=2735
 Planning:
   Buffers: shared hit=6
 Planning Time: 0.273 ms
 Execution Time: 1751.430 ms
  • 10% new lines, autovacuum is lagging: execution time +100 %
                                                     QUERY PLAN                                                      
═════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
 Index Only Scan using demoheapfetches_i_j_idx on demoheapfetches (actual time=0.066..2935.111 rows=1100000 loops=1)
   Heap Fetches: 100001
   Buffers: shared hit=745883 read=2486
 Planning Time: 0.186 ms
 Execution Time: 3365.290 ms
  • 30% new lines, autovacuum still lagging: execution time × 78 !!
                                                      QUERY PLAN                                                       
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
 Index Only Scan using demoheapfetches_i_j_idx on demoheapfetches (actual time=0.069..136461.243 rows=1300000 loops=1)
   Heap Fetches: 300001
   Buffers: shared hit=894764 read=112141
 Planning Time: 0.205 ms
 Execution Time: 136901.507 ms
  • after a vacuum: almost back to normal
                                                     QUERY PLAN                                                      
═════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
 Index Only Scan using demoheapfetches_i_j_idx on demoheapfetches (actual time=0.112..2040.199 rows=1300000 loops=1)
   Heap Fetches: 0
   Buffers: shared hit=811331 read=2857
 Planning:
   Buffers: shared hit=15 read=2
 Planning Time: 349.595 ms
 Execution Time: 2405.755 ms

from pev2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.