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 answers only not deleted user 34857

Specifically for PostgreSQL version 12

1 vote
Accepted

multi column index order for order by

No, your given index cannot be used for the ORDER BY. You can see this by doing set enable_sort=off and then explaining the query, you get a sort anyway because that is the only way PostgreSQL can ge …
jjanes's user avatar
  • 41.3k
1 vote

When to run Vacuum Full

Some cases where I would do VACUUM FULL: The system is about the run out of disk space and fall over. And that system is dominated by a very bloated table, but without bloated indexes. This should b …
jjanes's user avatar
  • 41.3k
0 votes

invalid integer value "CONNECTION" for connection option "port" Previous connection kept

It seems to me that what you really must have done is something like: \c CREATE SUBSCRIPTION my_sub CONNECTION ... The arguments to \c are positional, and the 4th position belongs to the port. I see …
jjanes's user avatar
  • 41.3k
1 vote
Accepted

pg_restore importing single table to a file

You need to read the documentation for the version you are using. Since v12, -f - is mandatory to get output to go to stdout. Having that behavior be obtained just by omitting -d was considered to be …
jjanes's user avatar
  • 41.3k
1 vote

PostgreSQL query takes a long time (as it's not using the index)

The entire query is planned up front, and at the time of planning it doesn't know what value will be found in CHECKPOINT1_PKEVENT. It makes the generic assumption that the inequality will match 1/3 o …
jjanes's user avatar
  • 41.3k
4 votes
Accepted

Use pg_cron to run VACUUM on multiple tables

You can vacuum a list of tables in one command. vacuum FULL pgbench_accounts, pgbench_history, pgbench_branches, pgbench_tellers; But hopefully you are not really doing FULL, that would almost surely …
jjanes's user avatar
  • 41.3k
2 votes

Stop rollback of anonymous DO code block?

You can commit inside the DO, as long as it is not already inside a transaction. create table foo (z double precision); do language PLPGSQL $$ declare i int; begin for i in 1 .. 12 loop ins …
jjanes's user avatar
  • 41.3k
8 votes

Postgres COPY with on conflict ignore - possible?

No. Maybe in some future version. Now about the best you can do is use file_fdw to map the file in as a foreign table, and then INSERT INTO...SELECT...ON CONFLICT DO NOTHING
jjanes's user avatar
  • 41.3k
2 votes

Poor execution plan leads to query time increasing dramatically

You can force it not use that index by rewriting the join condition to gtf.descendant_id = gv.garage_id + 0. Whether it will then switch to the good plan, or just switch to a different bad plan is no …
jjanes's user avatar
  • 41.3k
4 votes

FATAL 53300: Remaining connection slots are reserved for non-replication superuser connections

Regardless of whatever issues you might have, pg_cancel_backend cancels the backend's current query. But an idle backend doesn't have a current query, which is what makes it idle. You want pg_termin …
jjanes's user avatar
  • 41.3k
1 vote

CRONTAB fail to work

Cron sends the output of its command to you by email. Without an MTA, it can't do that. Which means you can't see what the output is. If you don't want to install and configure an MTA, then you sho …
jjanes's user avatar
  • 41.3k
11 votes

Handling performance problems with jit in postgres 12

In my opinion changing the default of jit to 'on' in v12 was a mistake, so based on that opinion turning it back off again seems pretty natural to me. I would have objected to the change if I had bee …
jjanes's user avatar
  • 41.3k
0 votes
Accepted

Select records that have at least one link to other tables

The 2nd query is activating JIT (Just-In-Time compilation), which is very counterproductive for you. 312 out of 472 ms is spent in the JIT. If you don't know that you benefit from JIT for other plans …
jjanes's user avatar
  • 41.3k
1 vote
Accepted

Postgresql: LIKE and partition by fields of the initial table

If you have a primary key, then you can't partition by a key which is not part of the primary key. Do you want a primary key on the new table? If so, you have to either add field1_in_tableA to the pri …
jjanes's user avatar
  • 41.3k
1 vote
Accepted

Postgres initialization of pg_basebackup

A physical backup (like pg_basebackup) results in an already initialized directory. You don't run initdb. You just start it up, possibly after changing the config files in whatever way is appropriat …
jjanes's user avatar
  • 41.3k

15 30 50 per page