Linked Questions

137 votes
5 answers

Measure the size of a PostgreSQL table row

I have a PostgreSQL table. select * is very slow whereas select id is nice and quick. I think it may be that the size of the row is very large and it's taking a while to transport, or it may be some ...
Joe's user avatar
  • 1,635
50 votes
5 answers

Aggressive Autovacuum on PostgreSQL

I'm trying to get PostgreSQL to aggressively auto vacuum my database. I've currently configured auto vacuum as follows: autovacuum_vacuum_cost_delay = 0 #Turn off cost based vacuum ...
CadentOrange's user avatar
11 votes
1 answer

Unexpected Seq Scan when doing query against boolean with value NULL

I have a database column called auto_review where column type is boolean. There is an index for that field, created using the ActiveRecord ORM. CREATE INDEX index_table_on_auto_renew ON table USING ...
Simone Carletti's user avatar
5 votes
3 answers

PostgreSQL ignores index, runs seq scan

My table contains an index for column total_balance: \d balances_snapshots Table "public.balances_snapshots" Column | Type ...
Andrey Kuznetsov's user avatar
3 votes
3 answers

Get count estimates from pg_class.reltuples for given conditions

Is it possible to query the reltuples column for a given table with additional conditions like LIKE 'hello%'? Currently on my bigger tables the SELECT count(*) query takes long and I ...
Christian Schmitt's user avatar
10 votes
1 answer

Best index for column where values are mostly the same

We have an integer column that currently consists only of 0 or 1 values. This column has now been used by a developer to store a unique 32-bit identifier on some occasions, and we need to be able to ...
whoasked's user avatar
  • 251
7 votes
1 answer

PostgreSQL partial index unused when created on a table with existing data

In PostgreSQL 9.3, I am attempting to create an efficient index on a rarely-used (0.00001% of total records) boolean column. To that end, I discovered this post on SO:
Jake Feasel's user avatar
5 votes
1 answer

For alignment optimized table is bigger than original table - why?

In another question I learned that I should optimize the layout from one of my tables to save space and have better performance. I did this, but ended up with a larger table than before and ...
tomka's user avatar
  • 937
4 votes
1 answer

Index on expression (regular expression pattern matching) is not used in query

In my PostgreSQL 12.8 database, I have a relatively simple table the_table with a column value with type varchar: CREATE TABLE public.the_table ( id uuid DEFAULT gen_random_uuid() NOT NULL, ...
Fabian Jäger's user avatar
0 votes
0 answers

Are unique indexes used to verifiy unicity on insert?

PostgreSQL 13.5, PostGIS 3.2, Windows server 2012 Here is the table I have created CREATE TABLE IF NOT EXISTS activite.unobs_rest ( gid integer NOT NULL, numunobs character varying(20) COLLATE ...
Leehan's user avatar
  • 207