Queries running forever, because of wrong rowcount estimate

2023-02-11 Thread Peter
TL;DR Version: == For a table where all rows have been deleted, under certain conditions the planner does assume that it contains the values that were previousely present, and will therefore assume that nothing needs to be added, while in fact everything needs to be added. - This

Re: pg_trgm vs. Solr ngram

2023-02-11 Thread Christian Ramseyer (mx04)
On 10.02.23 04:48, Laurenz Albe wrote: On Fri, 2023-02-10 at 03:20 +0100, Chris wrote: In Solr I was using ngrams and customized the TokenizerFactories until more or less only whitespace was as separator, while [.:-_\d] remains part of the ngrams. This allows to search for ".12.255/32" or

Re: WHERE col = ANY($1) extended to 2 or more columns?

2023-02-11 Thread Peter J. Holzer
On 2023-02-11 16:21:49 +0100, Peter J. Holzer wrote: > On 2023-02-09 18:35:42 +0100, Dominique Devienne wrote: > > Right. The goal is to (re)use a prepared statement (i.e. plan once), and > > bind > > the RHS (binary) array > > and do a single exec (single round-trip) to get the matching rows.

Re: valgrind a background worker

2023-02-11 Thread Jon Erdman
On 2/10/23 3:05 PM, Tom Lane wrote: > Jeffrey Walton writes: >> On Fri, Feb 10, 2023 at 10:04 AM Tom Lane wrote: >>> You have to valgrind the whole cluster AFAIK. Basically, start >>> the postmaster under valgrind with --trace-children=yes. >>> For leak tracking you probably also want >>>

Re: WHERE col = ANY($1) extended to 2 or more columns?

2023-02-11 Thread Peter J. Holzer
On 2023-02-09 18:35:42 +0100, Dominique Devienne wrote: > On Thu, Feb 9, 2023 at 5:37 PM David G. Johnston > wrote: > > On Thu, Feb 9, 2023 at 9:28 AM Alban Hertroys wrote: > > > On 9 Feb 2023, at 16:41, Dominique Devienne > wrote: > > Now we'd like to do the same

Re: How to pass table column values to function

2023-02-11 Thread jian he
On Sat, Feb 11, 2023 at 3:55 PM Andrus wrote: > Hi! > > Table source contains integer column. Its values should be passed to > function for selecting data from other table. > > I tried > > CREATE OR REPLACE FUNCTION > public.TestAddAssetTransactions(dokumnrs int[]) > RETURNS int

Re: How to pass table column values to function

2023-02-11 Thread Marcos Pegoraro
Em sáb., 11 de fev. de 2023 às 07:10, Andrus escreveu: > Hi! > > Table source contains integer column. Its values should be passed to > function for selecting data from other table. > > I tried > > CREATE OR REPLACE FUNCTION > public.TestAddAssetTransactions(dokumnrs int[]) >

How to pass table column values to function

2023-02-11 Thread Andrus
Hi! Table source contains integer column. Its values should be passed to function for selecting data from other table. I tried     CREATE OR REPLACE FUNCTION public.TestAddAssetTransactions(dokumnrs int[]) RETURNS int AS     $BODY$     with i1 as (     INSERT INTO