Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Diagnose these as three separate questions: how much space a relation or index actually uses, how many writes occur across a clearly defined measurement boundary, and how often PostgreSQL finds requested blocks in its shared buffers. File size alone does not prove index bloat, a PostgreSQL buffer hit is not proof that storage avoided a physical read, and there is no single write-amplification ratio that automatically attributes every write to PostgreSQL.

Measure space before calling an index bloated

A large index may be appropriate for its data and workload. To investigate wasted space, measure the relation’s tuple and free-space composition and inspect B-tree page structure; then compare those observations with the index’s history and actual performance. PostgreSQL does not prescribe a universal bloat-percentage threshold in its PostgreSQL 18 documentation.

Inspect relation space with pgstattuple

The supplied pgstattuple extension reports a relation’s physical length, live and dead tuple data, and free space. Where extension installation and access are permitted, enable it in the database and inspect a relation:

CREATE EXTENSION pgstattuple;

SELECT *
FROM pgstattuple('public.my_table'::regclass);

Replace public.my_table with the schema-qualified relation name. The function acquires a read lock and accumulates its result page by page. Concurrent changes can therefore mean the returned figures do not describe one instantaneous, whole-relation state. By default, access to these functions is restricted to superusers and the pg_stat_scan_tables role.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Inspect B-tree pages with pgstatindex

For a B-tree index, pgstatindex reports physical size and page-structure measurements, including tree and page counts, average leaf density, and leaf fragmentation:

SELECT *
FROM pgstatindex('public.my_index'::regclass);

Its result is also collected page by page, rather than as an instantaneous snapshot. Treat density and fragmentation as diagnostic evidence, not as pass/fail thresholds: interpret them alongside index type, workload, page fill behavior, index growth, and whether the space can be reused.

Corroborate with index use and workload history

Use index statistics to understand whether an index participates in observed work. For example:

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
SELECT schemaname, relname, indexrelname,
       idx_scan, idx_tup_read, idx_tup_fetch
FROM pg_stat_user_indexes
ORDER BY schemaname, relname, indexrelname;

These counters do not directly measure bloat or prove that an index is unnecessary. A bitmap scan increments the relevant index’s idx_tup_read count, while associated heap fetches are counted at the table level; an index scan can also make several index searches during one executor-node execution. Check the statistics reset time and use a representative interval. Review workload history and actual query plans before deciding to remove an index, especially when its counters cover only a short period.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Interpret buffer cache hit ratios in context

PostgreSQL’s pg_statio views expose block reads and buffer hits. A useful PostgreSQL-level ratio for a chosen set of objects is hits / (hits + reads). The result describes those counters over their collection interval; it is not a direct measure of physical-device I/O.

Calculate a per-index ratio

This query reports the ratio for each user index with nonzero recorded block activity:

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
SELECT schemaname, relname, indexrelname,
       idx_blks_hit, idx_blks_read,
       round(100.0 * idx_blks_hit /
             NULLIF(idx_blks_hit + idx_blks_read, 0), 2) AS hit_pct
FROM pg_statio_user_indexes
ORDER BY schemaname, relname, indexrelname;

For an aggregate across a selected set of indexes, divide the sum of hits by the sum of hits plus reads. Do not take an unweighted average of per-index percentages: that would give a rarely accessed index the same influence as a heavily accessed one. State which objects and counters you included and the interval they cover. Check pg_stat_database.stats_reset to see when database statistics were reset.

Separate shared-buffer activity from physical I/O

A block counted as a PostgreSQL read may have come from the operating system’s page cache rather than physical storage. PostgreSQL’s I/O counters do not distinguish those cases. Pair database-level counters with operating-system monitoring when the question is whether the device is doing I/O. A high PostgreSQL hit ratio by itself neither identifies the cause of latency nor proves that the workload is efficient.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The pg_buffercache extension can show a real-time view of shared-buffer entries, but its output is not a consistent snapshot across all buffers. It has default privilege restrictions, and retrieving its NUMA inspection view is more costly. Use it to investigate a particular state, not as a substitute for interval-based I/O measurements.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Define write amplification before reporting a number

Write amplification has no universal PostgreSQL ratio that cleanly attributes writes across heap pages, index pages, WAL, checkpoints, operating-system caching, and storage hardware. PostgreSQL relation read and hit counters, and index-usage counters, do not establish such a ratio.

If you report a write ratio, name the measurement boundary and define both sides of it. For example, an operator might compare device-level bytes written with a separately measured logical workload volume over the same interval. That is an operator-defined metric, not a PostgreSQL-standard formula; the numerator and denominator are not interchangeable with WAL bytes, relation changes, or application requests. Identify the data source, scope, interval, and workload represented, and do not claim the ratio attributes writes to a particular index unless the measurement supports that attribution.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Choose maintenance by the space problem and its cost

Cleanup, file shrinking, and index rebuilding are different operations. PostgreSQL 18’s VACUUM and Routine Reindexing documentation describes different effects and lock requirements; choose an operation based on the space you need to reclaim and the downtime, I/O, and capacity you can accept.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Action What it does Lock and operational considerations
VACUUM Removes dead tuples and usually makes reclaimed space available for reuse within the relation; it ordinarily does not shrink the relation file for the operating system. Works alongside normal reads and writes, but can generate substantial I/O that affects active sessions. Index cleanup matters because dead tuples can accumulate in indexes if cleanup is not performed regularly.
VACUUM FULL Rewrites the table and can return reclaimed space to the operating system. Slower than plain vacuum, requires extra disk space for the replacement copy, and takes an ACCESS EXCLUSIVE lock. PostgreSQL does not recommend it for routine use.
Default REINDEX Rebuilds the specified index. Requires an ACCESS EXCLUSIVE lock; plan for the lock and the work of rebuilding.
REINDEX CONCURRENTLY Rebuilds an index with reduced lock severity compared with default reindexing. Requires a SHARE UPDATE EXCLUSIVE lock. Concurrent reindexing reduces the lock severity, but does not make the rebuild cost-free.

When reindexing may address B-tree space

Fully empty B-tree pages can be reused. Pages that retain a few keys may remain allocated even when they are poorly utilized. PostgreSQL recommends periodic reindexing for the specific deletion pattern in which most, but not all, keys in each key range are removed. That is not a blanket recommendation to rebuild every large or low-density index. PostgreSQL notes that bloat in non-B-tree index types is less well researched, so do not assume the B-tree guidance applies to other access methods.

Use a decision sequence, not one alarming metric

  1. Establish the symptom. Decide whether the concern is storage consumption, query latency, write pressure, or filesystem capacity; they require different evidence.
  2. Measure physical composition. Use pgstattuple for relation tuple and free-space data and pgstatindex for B-tree page structure, subject to extension permissions and the page-by-page collection caveat.
  3. Set the observation window. Check statistics reset time and compare usage and I/O counters over a representative workload interval. A short or reset interval can make useful indexes appear unused.
  4. Check database and host I/O separately. Use pg_statio for PostgreSQL buffer hits and reads, and operating-system monitoring to assess physical I/O.
  5. Choose the least disruptive operation that meets the objective. Prefer reuse-oriented vacuum when internal reuse is the goal; reserve rewrites or rebuilds for an evidenced need, with sufficient disk headroom and a lock plan.
  6. For write amplification, publish only a defined measurement. Name the numerator, denominator, sources, scope, and interval; otherwise report the underlying measures separately rather than implying a universal ratio.

PostgreSQL documentation and available extension behavior are version-sensitive. Confirm the deployed major version and hosted-service restrictions before using these commands or assuming an extension can be installed.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.