Re: function currtid2() in SQL and ESQL/C to get the new CTID of a row

2022-06-22 Thread Matthias Apitz
El día miércoles, junio 22, 2022 a las 08:39:31 +0200, Matthias Apitz escribió: > > EXEC SQL SELECT currtid2(:table ::text, :oldCTID ::tid) INTO :newCTID; > > > > ... > > Hello Tom, > > We came accross cases where the above SELECT returns as :newCTID the > same as the :oldCTID. The :oldCTID

Re: Tuning a query with ORDER BY and LIMIT

2022-06-22 Thread Jeff Janes
On Wed, Jun 22, 2022 at 6:19 PM Peter J. Holzer wrote: > > >That's just how btree indexes work and Oracle will have the same > >limitation. What would be possible is to use an index only scan > >(returning 2,634,718 matching results), sort that to find the 50 newest > >entries and retrieve only

Re: Tuning a query with ORDER BY and LIMIT

2022-06-22 Thread Jeff Janes
On Wed, Jun 22, 2022 at 3:39 PM Dirschel, Steve < steve.dirsc...@thomsonreuters.com> wrote: > explain (analyze, verbose, costs, buffers, timing, summary, hashes) > 'hashes', what's that? Are you using community PostgreSQL, or someones fork? > With Oracle for a query like this since the index

Re: ERROR: new collation (en_US.UTF-8) is incompatible with the collation of the template database (en_US.utf-8)

2022-06-22 Thread Tom Lane
Tomas Pospisek writes: > On 22.06.22 21:25, Adrian Klaver wrote: >> On 6/22/22 12:17, Tomas Pospisek wrote: >>> If I `pg_dump --create` some DB on the new server (13.7-1.pgdg18.04+1) >>> I get: >>> >>> CREATE DATABASE ... ENCODING = 'UTF8' LOCALE = 'en_US.utf-8'; >>> >>> When I do the

Re: Tuning a query with ORDER BY and LIMIT

2022-06-22 Thread Tom Lane
"Peter J. Holzer" writes: > On 2022-06-22 19:39:33 +, Dirschel, Steve wrote: >> create index workflow_execution_initial_ui_tabs >> on workflow_execution (workflow_id asc, status asc, result asc, >> completed_datetime desc); > [...] >> explain (analyze, verbose, costs, buffers, timing,

Re: Tuning a query with ORDER BY and LIMIT

2022-06-22 Thread Peter J. Holzer
On 2022-06-23 00:19:19 +0200, Peter J. Holzer wrote: > On 2022-06-22 23:48:37 +0200, Peter J. Holzer wrote: > > The index cannot be used for sorting, since the column used for sorting > > isn't in the first position in the index. > > compared to a single value ^ not E-Mail really needs a

Re: Tuning a query with ORDER BY and LIMIT

2022-06-22 Thread Peter J. Holzer
On 2022-06-22 23:48:37 +0200, Peter J. Holzer wrote: > On 2022-06-22 19:39:33 +, Dirschel, Steve wrote: > > Posrgres version 10.11 > > > > Here is the DDL for the index the query is using: > > > > create index workflow_execution_initial_ui_tabs > > on workflow_execution (workflow_id asc,

Re: Tuning a query with ORDER BY and LIMIT

2022-06-22 Thread Peter J. Holzer
On 2022-06-22 19:39:33 +, Dirschel, Steve wrote: > create index workflow_execution_initial_ui_tabs > on workflow_execution (workflow_id asc, status asc, result asc, > completed_datetime desc); [...] > explain (analyze, verbose, costs, buffers, timing, summary, hashes) > select * from

Re: Tuning a query with ORDER BY and LIMIT

2022-06-22 Thread Peter J. Holzer
On 2022-06-22 19:39:33 +, Dirschel, Steve wrote: > Posrgres version 10.11 > > Here is the DDL for the index the query is using: > > create index workflow_execution_initial_ui_tabs > on workflow_execution (workflow_id asc, status asc, result asc, > completed_datetime desc); > > explain

Re: ERROR: new collation (en_US.UTF-8) is incompatible with the collation of the template database (en_US.utf-8)

2022-06-22 Thread Tomas Pospisek
On 22.06.22 21:25, Adrian Klaver wrote: On 6/22/22 12:17, Tomas Pospisek wrote: Hi all, while doing `cat pg_dump.dump | psql` I get the above message. Note that `pg_dump.dump` contains: CREATE DATABASE some_db WITH TEMPLATE = my_own_template ENCODING = 'UTF8' LC_COLLATE =

Re: Tuning a query with ORDER BY and LIMIT

2022-06-22 Thread Michael van der Kolff
What do you see when you remove the LIMIT clause? It may be possible to rewrite this using ROW_NUMBER. --Michael On Thu, Jun 23, 2022 at 5:39 AM Dirschel, Steve < steve.dirsc...@thomsonreuters.com> wrote: > I am fairly new to tuning Postgres queries. I have a long background > tuning Oracle

Tuning a query with ORDER BY and LIMIT

2022-06-22 Thread Dirschel, Steve
I am fairly new to tuning Postgres queries. I have a long background tuning Oracle queries. Posrgres version 10.11 Here is the DDL for the index the query is using: create index workflow_execution_initial_ui_tabs on workflow_execution (workflow_id asc, status asc, result asc,

Re: ERROR: new collation (en_US.UTF-8) is incompatible with the collation of the template database (en_US.utf-8)

2022-06-22 Thread Adrian Klaver
On 6/22/22 12:17, Tomas Pospisek wrote: Hi all, while doing `cat pg_dump.dump | psql` I get the above message. Note that `pg_dump.dump` contains:     CREATE DATABASE some_db WITH TEMPLATE = my_own_template ENCODING = 'UTF8' LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8'; What is

ERROR: new collation (en_US.UTF-8) is incompatible with the collation of the template database (en_US.utf-8)

2022-06-22 Thread Tomas Pospisek
Hi all, while doing `cat pg_dump.dump | psql` I get the above message. Note that `pg_dump.dump` contains: CREATE DATABASE some_db WITH TEMPLATE = my_own_template ENCODING = 'UTF8' LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8'; What is exactly the problem? I understand that

RE: Postgresql error : PANIC: could not locate a valid checkpoint record

2022-06-22 Thread Mahendrakar, Prabhakar - Dell Team
Hello there, Please find my response below > You should not be using 13.4, but the latest minor release, at this point > 13.7. May be in the near future we would migrate to 13.7 and not now at present. > Anyway, the error message looks like somebody removed the contents of the >

RE: Postgresql error : PANIC: could not locate a valid checkpoint record

2022-06-22 Thread Mahendrakar, Prabhakar - Dell Team
Hello there, Please find my response as below: * Also, are you able to reproduce the issue? No we are not able to reproduce at our end. But this is happening occasionally at customer environment that has large DB size. * I.e. try restoring the database to state before upgrade, try to

PostgreSQL with Patroni not replicating to all nodes after adding 3rd node (another secondary)

2022-06-22 Thread Zb B
Hi, I am new to Patroni and PostgreSQL.We have set up a cluster with etcd (3 nodes), Patroni (2 nodes) and PostgreSQL (2 nodes) with replication from primary to secondary.In SYNC mode. Seemed to work fine. Then I added a third DB node without Patroni - just to replicate the data from the primary

RE: How to use 32 bit ODBC driver

2022-06-22 Thread Aditya Bhardwaj
Yes, I installed it. However, following installation, it shows up in the 64-bit ODBC Data Source but not the 32-bit. Regards, Aditya Bhardwaj From: Rino Mardo Sent: 21 June 2022 06:57 PM To: Aditya Bhardwaj Cc: pgsql-general@lists.postgresql.org Subject: Re: How to use 32 bit ODBC driver hi.

Source code test data folder don't have CSV files. How to get the CSV file.

2022-06-22 Thread jian he
trying to understand the source code test part. https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/test/regress/sql/copy.sql;h=d72d226f341f42c69ffcb773c4faf53d9e586894;hb=072132f04e55c1c3b0f1a582318da78de7334379 First I can just ignore all the abs_srcdir, abs_builddir. Since I can

Re: function currtid2() in SQL and ESQL/C to get the new CTID of a row

2022-06-22 Thread Matthias Apitz
El día Wednesday, June 01, 2022 a las 09:46:17AM -0400, Tom Lane escribió: > ... > > > Is this function currtid2() not meant to be used in ESQL/C? Or did we > > something wrong in ESQL/C? > > This is not about currtid2, this is a fundamental misunderstanding > of how ECPG works. You can only