Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 7119

Performance issues with PostgreSQL queries

1 vote
Accepted

PostgreSQL plan cache and variable number of arguments

Q: what is the key for plan cache in Postgres? It's the prepared statement associated to the query if there is one, and it does not happen automatically. Outside of prepared statements, there is no …
Daniel Vérité's user avatar
2 votes
Accepted

Index for searching in column where the column starts with the provided value

Q: SELECT id FROM table WHERE 'example.org/sub/sub/sub/test.html' LIKE (domain || '%') which gives what I want, but it always does a seq scan of the table, even though that I have an index on the do …
Daniel Vérité's user avatar
1 vote

Need to free up space by removing pg_wal files in Postgres

If you have no plan to use these files for recovery, you can temporarily set archive_command to a command that succeeds but does nothing. The server will call it on each WAL file to archive and then d …
Daniel Vérité's user avatar
0 votes

sql query to get results specific rows but count of all the rows of table

with the count(), I want to get the count of all the rows present irrespective of the where clause. This can be done with an independent subquery in the select-list, if it returns a single value, as …
Daniel Vérité's user avatar
0 votes

How to detect performance issues in function working on temporary tables?

Quote: I can't do an explain analyze on temporary tables to detect expensive operations. It's not common to execute EXPLAIN ANALYZE inside a function but it's doable in plpgsql, with either: explai …
Daniel Vérité's user avatar
5 votes

Get a truly RANDOM row from a PostgreSQL table quickly

Your mistake is to always take the first row of the sample. Take a random row instead: SELECT * FROM (SELECT column FROM table TABLESAMPLE BERNOULLI(1)) AS s ORDER BY RANDOM() LIMIT 1; The cont …
Daniel Vérité's user avatar
1 vote

Optimize user segmentation by bytea column

I'm not sure, if PostgreSQL each time of this update will overwrite full file or only one bit in the hard disk? PostgreSQL will definitely rewrite the whole column on any change, as it cannot d …
Daniel Vérité's user avatar
1 vote

Cost of updating one of several toasted columns

Assuming all other columns could be stored in the non-toasted table, would an update to column b require writing column a again? No. According to the documentation (in Out-of-Line, On-Disk TOAST Stor …
Daniel Vérité's user avatar
0 votes
Accepted

postgres table sizing inconsistency

I would expect that after shutting down all other sessions and running a VACUUM ANALYSE, the way the tables are used wouldn't make any difference. It's the VACUUM ANALYZE that does not make a …
Daniel Vérité's user avatar
1 vote

Store large compressed documents in Postgresql

Postgres compresses automatically large objects chunks, as well as bytea through the TOAST mechanism. But most PDFs are already compressed. As an example I have 1000 dedup-ed pdfs in my mailbox store …
Daniel Vérité's user avatar
3 votes

postgresql optimize query with 'where not in' clause

First you may try two things: Do not use WITH because it's an optimization fence. As of PostgreSQL 10, the result of the CTE query will be materialized even if it would be better not to. Use NOT EXI …
Daniel Vérité's user avatar
8 votes

Full text search over multiple related tables: indices and performance

This looks like a fairly generic full-text search problem in a relational database. Your prediction that updates in actors or objects would be troublesome in a denormalized structure looks spot-on. B …
Daniel Vérité's user avatar
7 votes
Accepted

pgAdmin is extremely slow on any remote operation

The extract from pgadmin.log shows that for each output column of the result, pgadmin executes two queries against the catalog, one to obtain the formatted name of the type from its oid, another to ob …
Daniel Vérité's user avatar
4 votes

Postgres Slow Queries - Autovacuum frequency

The formula that probably explains your case is (as documented in The Autovacuum Daemon): ...if the number of tuples obsoleted since the last VACUUM exceeds the "vacuum threshold", the table is …
Daniel Vérité's user avatar
2 votes
Accepted

PostgreSQL - Return unique combinations of columns based on where clause

The execution plan shown does not seem to match the big SELECT DISTINCT query because the Sort and Unique steps are missing. Anyway you are correct than when retrieving ~50% of a table, index don't he …
Daniel Vérité's user avatar

15 30 50 per page