Free tools Windows power users keep installed

One-click scans. No signup required.

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

In PostgreSQL 18, create a hash index with CREATE INDEX … USING hash, inspect its definition and access method through psql or system catalogs, and remove it with DROP INDEX. Hash indexes support equality lookups only, index one column, and cannot enforce uniqueness; confirm a hash index fits your workload before deploying it.

Create a hash index

Specify USING hash in the CREATE INDEX statement. If you omit the method, PostgreSQL creates a B-tree index instead. The index is created in the same schema as its table, so a descriptive name and a schema-qualified table reference help avoid ambiguity.

CREATE INDEX users_email_hash_idx
    ON public.users USING hash (email);

This creates a single-column, non-unique index on public.users.email. PostgreSQL hash indexes cannot be used to enforce uniqueness; use a suitable unique constraint or unique B-tree index when uniqueness is required.

IF NOT EXISTS can avoid an error if an index with the same name already exists, but it does not verify that the existing index has the requested table, column, or method. Inspect the definition before assuming it matches. See the PostgreSQL 18 CREATE INDEX documentation.

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.

Choose blocking or concurrent creation

A regular index build blocks writes to the table until it finishes, although reads can continue. For a live table, PostgreSQL offers concurrent creation:

CREATE INDEX CONCURRENTLY users_email_hash_idx
    ON public.users USING hash (email);

Concurrent creation allows ordinary inserts, updates, and deletes during the build, but takes longer: it performs two table scans and waits for relevant transactions. It cannot run inside a transaction block, and only one concurrent index build can run on a table at a time.

If a concurrent build fails, it can leave an invalid index. Such an index is ignored for queries but still adds overhead to table updates. Check its status, remove the invalid index and retry, or consider REINDEX INDEX CONCURRENTLY where appropriate. In PostgreSQL 18, concurrent creation is not supported as a single operation on a partitioned table; the documented approach is to build indexes concurrently on individual partitions and attach them through the supported procedure. Consult the PostgreSQL 18 CREATE INDEX documentation for the command’s full restrictions.

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.

Inspect indexes and confirm the method

In psql, di lists indexes, while di+ adds details such as disk size. To see the indexes and definitions associated with a table, use d public.users. An invalid index left by a failed concurrent build can appear as INVALID in the table display. The psql reference describes these commands.

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

For SQL-based inspection, the pg_indexes view provides the schema, table, index name, tablespace, and reconstructed definition:

SELECT schemaname, tablename, indexname, tablespace, indexdef
FROM pg_indexes
WHERE schemaname = 'public'
  AND tablename = 'users'
ORDER BY indexname;

To confirm the access method directly, join the index relation in pg_class to pg_am. This distinguishes a hash index from a B-tree even when the index name is unclear:

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 ns.nspname AS index_schema,
       idx.relname AS index_name,
       am.amname AS index_method,
       pg_get_indexdef(idx.oid) AS index_definition
FROM pg_class AS idx
JOIN pg_namespace AS ns ON ns.oid = idx.relnamespace
JOIN pg_am AS am ON am.oid = idx.relam
WHERE idx.relkind = 'i'
  AND ns.nspname = 'public'
ORDER BY idx.relname;

This query lists ordinary indexes in the public schema; add a table or index-name condition to narrow the results. A partitioned index parent has a different relation kind, so include it separately if you are inspecting partitioned indexes. The relevant catalog fields and view are documented in pg_class, pg_am, and pg_indexes.

Decide whether a hash index suits the query

A hash index is intended for equality predicates such as email = 'person@example.com'. It does not support range predicates such as email > 'm'. A B-tree supports equality and ordered or range comparisons, and can also be multicolumn or unique; a hash index is single-column and non-unique.

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

Hash-index entries store a four-byte hash value rather than the original indexed value. Because the stored value is not the original key, index scans are lossy and must recheck matching table rows. Hash indexes can participate in bitmap index scans. PostgreSQL notes that a hash index may be smaller than a B-tree for longer values such as UUIDs or URLs, but that does not establish a speed advantage. Bucket growth, overflow behavior, row distribution, and the number of rows mapping to buckets can affect performance.

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

There is no universal performance winner. Compare the methods using the actual predicate, data distribution, value lengths, table size, insert and update pattern, and query selectivity. The PostgreSQL documentation describes these trade-offs in Hash Indexes and Index Types; it does not provide a current numeric benchmark proving hash indexes are faster.

Check the planner and measure representative work

First make sure table statistics are current when needed, then inspect the plan for the real query:

ANALYZE public.users;
EXPLAIN (ANALYZE, BUFFERS)
SELECT * FROM public.users WHERE email = 'person@example.com';

ANALYZE refreshes planner statistics; whether it is needed depends on how current the table’s statistics are. EXPLAIN shows the planner’s chosen plan. EXPLAIN ANALYZE actually executes the query and reports actual rows and timing alongside estimates, so use it with care for statements that modify data or have side effects. Its measurements have overhead and exclude client network transfer; results on a small test table should not be assumed to predict behavior on a substantially different production workload. Do not force planner settings as proof that an index helps; evaluate natural plans and representative workload measurements. See the PostgreSQL 18 EXPLAIN documentation.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Drop a hash index

Remove an index by name, including its schema when needed:

DROP INDEX public.users_email_hash_idx;

Use IF EXISTS if a missing or previously removed index should produce a notice rather than an error:

DROP INDEX IF EXISTS public.users_email_hash_idx;

The index owner must run the command. By default, RESTRICT refuses the drop if dependent objects exist. CASCADE recursively removes dependent objects, so use it only after reviewing what depends on the index.

Drop without blocking concurrent table access

On an active table, you can request a concurrent drop:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
DROP INDEX CONCURRENTLY public.users_email_hash_idx;

A regular drop takes an ACCESS EXCLUSIVE lock on the table and can block other access until completion. Concurrent drop avoids locking out concurrent selects, inserts, updates, and deletes while it waits for conflicting transactions, but it has important limits: it accepts only one index name, cannot use CASCADE, cannot remove an index backing a UNIQUE or PRIMARY KEY constraint, cannot run inside a transaction block, and cannot be used on indexes on partitioned tables. Details are in the PostgreSQL 18 DROP INDEX documentation.

PostgreSQL 18 command reference

Task Command Key consideration
Create CREATE INDEX users_email_hash_idx ON public.users USING hash (email); Equality only; one column; not unique.
Create during ordinary writes CREATE INDEX CONCURRENTLY users_email_hash_idx ON public.users USING hash (email); Longer build, two scans, waits; no transaction block.
Inspect in psql di+ or d public.users Check the definition and whether an index is invalid.
Drop DROP INDEX public.users_email_hash_idx; Regular drop can block table access.
Drop during concurrent access DROP INDEX CONCURRENTLY public.users_email_hash_idx; One index only; no transaction block, cascade, or partitioned-table index.

These commands and operational details refer to PostgreSQL 18 documentation. PostgreSQL’s current documentation alias can move to a later release, so check the documentation matching your server version when applying them.

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.