Re: Lookup tables

2025-02-07 Thread Michał Kłeczek
> On 6 Feb 2025, at 22:03, Peter J. Holzer wrote: > > On 2025-02-04 22:41:38 +0100, Thiemo Kellner wrote: >> >> I might see what you want to point out. E.g. the table is COLOURS. The >> rec with id 1 is RED, the one with id 2 is BLUE, 3 is GREE and so on. >> Now you load these values into the

Re: Lookup tables

2025-02-05 Thread Michał Kłeczek
> On 5 Feb 2025, at 21:33, Thiemo Kellner wrote: > > > El 05-02-25 a las 13:55, Michał Kłeczek escribió: >>> A) Your release changed the sementics of the record 3. It's meaning >>> changed. I cannot recommend doing that. >> That’s what using natura

Re: Lookup tables

2025-02-05 Thread Michał Kłeczek
> On 5 Feb 2025, at 19:07, Thiemo Kellner wrote: > > El 04-02-25 a las 18:08, Michał Kłeczek escribió: >>> Reality tends to become so ambiguous as to not be >>> reflectable (two entirely different restaurants eventually, >>> within the flow of time, c

Re: Lookup tables

2025-02-05 Thread Michał Kłeczek
> On 4 Feb 2025, at 22:41, Thiemo Kellner wrote: > > 04.02.2025 18:31:09 Michał Kłeczek : > >> >>> On 4 Feb 2025, at 18:27, Thiemo Kellner wrote: >>> >>>  Unless the lookup table is actually a check constraint one can use to >>> p

Re: Lookup tables

2025-02-04 Thread Michał Kłeczek
> On 4 Feb 2025, at 18:11, David G. Johnston wrote: > > On Tue, Feb 4, 2025 at 9:31 AM Michał Kłeczek <mailto:mic...@kleczek.org>> wrote: >> >> >> > On 4 Feb 2025, at 15:27, Rich Shepard > > <mailto:rshep...@appl-ecosys.com>> wrote: &g

Re: Lookup tables

2025-02-04 Thread Michał Kłeczek
> On 4 Feb 2025, at 18:27, Thiemo Kellner wrote: > >  Unless the lookup table is actually a check constraint one can use to > populate dropdown boxes in an interface. That is even worse because it ceases being transactional and users might select something different than what they see on th

Re: Lookup tables

2025-02-04 Thread Michał Kłeczek
> On 4 Feb 2025, at 17:51, Karsten Hilbert wrote: > > Am Tue, Feb 04, 2025 at 05:31:13PM +0100 schrieb Michał Kłeczek: > >> It is now completely unclear what it means to change the name of the >> restaurant for already registered visits. >> Is it still the sa

Re: Lookup tables

2025-02-04 Thread Michał Kłeczek
> On 4 Feb 2025, at 15:27, Rich Shepard wrote: > > Should lookup tables have a numeric FK column as well as the description > column? > > If so, how should I add an FK to the two lookup tables in my database? I’ve read the whole thread and the reasoning for having (numeric) autogenerated s

Re: Logical replication disabled, recovery not possible because of 1 large transaction with schema changes?

2024-10-17 Thread Michał Kłeczek
> On 17 Oct 2024, at 11:07, Koen De Groote wrote: > > Hello Muhammad, > > The problem with my scenario is the changes are written as a single > transaction, with a BEGIN and COMMIT. In that transaction, there are first > inserts, then a schema change, and then inserts on the new schema. I

Merging logical subscriptions

2024-10-16 Thread Michał Kłeczek
Hi, I have a question about an algorithm to “merge” two logical replication subscriptions. Here is the scenario: We have a server with many tables replicated using logical replication to downstream replicas. Each table is published with a separate publication. At the moment each replica uses a

Partitionwise aggregate and runtime partition pruning

2024-09-26 Thread Michał Kłeczek
Hi All, I have a question about partition pruning. Does runtime partition pruning (ie. pruning performed during execution) work with partition wise aggregates? 1) I have a setup with a mix of foreign (postgres_fdw) and local partitions. 2) I want to perform an aggregate query and I want the agg

Re: How batch processing works

2024-09-20 Thread Michał Kłeczek
Hi, > On 19 Sep 2024, at 07:30, Lok P wrote: > [snip] > > Method-4 > > INSERT INTO parent_table VALUES (1, 'a'), (2, 'a'); > INSERT INTO child_table VALUES (1,1, 'a'), (1,2, 'a'); > commit; I’ve done some batch processing of JSON messages from Kafka in Java. By far the most performant way

Re: Pgxs - How to reference another extension

2024-03-11 Thread Michał Kłeczek
> On 11 Mar 2024, at 15:00, Pavel Stehule wrote: > > > The advantage of OidFunctionCall is fact, it is working on MacOS. My > extension plpgsql_check has a lot of dependencies on plpgsql. > > The linking on MacOS required special section in Makefile > > ifeq ($(PORTNAME), darwin) > overrid

Re: Pgxs - How to reference another extension

2024-03-11 Thread Michał Kłeczek
> On 11 Mar 2024, at 14:08, Artur Zakirov wrote: > > On Mon, 11 Mar 2024 at 13:26, Michał Kłeczek <mailto:mic...@kleczek.org>> wrote: >> >> >>> On 11 Mar 2024, at 11:41, Michał Kłeczek wrote: >>> >>> Hi, >>> >>>

Re: Pgxs - How to reference another extension

2024-03-11 Thread Michał Kłeczek
> On 11 Mar 2024, at 11:41, Michał Kłeczek wrote: > > Hi, > > I am trying to create an extension that delegates some calls to btree_gist > functions: > > DirectFunctionCall5Coll( >gbt_text_consistent, …other arguments); > > Basic PGXS Make

Pgxs - How to reference another extension

2024-03-11 Thread Michał Kłeczek
Hi, I am trying to create an extension that delegates some calls to btree_gist functions: DirectFunctionCall5Coll( gbt_text_consistent, …other arguments); Basic PGXS Makefile does not work - I get linker error: Undefined symbols for architecture arm64: "_gbt_text_consistent"

Re: postgres_fdw aggregate pushdown for group by with expressions

2024-03-04 Thread Michał Kłeczek
Hi All, > On 3 Mar 2024, at 10:34, Michał Kłeczek wrote: > > Hi, > > I have the following foreign table: > > CREATE FOREIGN TABLE t1 ( > grouping_column text, > date_column date, > whatever_data int > ); > > The query is: > > SELECT

Re: postgres_fdw aggregate pushdown for group by with expressions

2024-03-03 Thread Michał Kłeczek
> On 4 Mar 2024, at 07:46, Michał Kłeczek wrote: > > > >> On 3 Mar 2024, at 18:42, Tom Lane wrote: >> >> =?utf-8?Q?Micha=C5=82_K=C5=82eczek?= writes: >>> I’ve performed some more tests and it seems expressions with “extract” >>> function

Re: postgres_fdw aggregate pushdown for group by with expressions

2024-03-03 Thread Michał Kłeczek
> On 3 Mar 2024, at 18:42, Tom Lane wrote: > > =?utf-8?Q?Micha=C5=82_K=C5=82eczek?= writes: >> I’ve performed some more tests and it seems expressions with “extract” >> function are not pushed down at all - > > Yeah :-(. I traced through this, and it seems it's a collation > problem. Inte

Re: postgres_fdw aggregate pushdown for group by with expressions

2024-03-03 Thread Michał Kłeczek
Ok, so that means the workaround is to create an extension with year(date) and month(date) functions that internally would call extract. Not ideal but workable I guess. — Michał > On 3 Mar 2024, at 18:42, Tom Lane wrote: > > =?utf-8?Q?Micha=C5=82_K=C5=82eczek?= writes: >> I’ve performed so

Re: postgres_fdw aggregate pushdown for group by with expressions

2024-03-03 Thread Michał Kłeczek
Thanks for help. >> I’ve performed some more tests and it seems expressions with “extract” >> function are not pushed down at all - >> the WHERE criteria from the following query are not pushed down as well and >> filter is performed locally: >> SELECT >> * >> FROM >> t1 >> WHERE extract(YEA

Re: postgres_fdw aggregate pushdown for group by with expressions

2024-03-03 Thread Michał Kłeczek
> On 3 Mar 2024, at 10:34, Michał Kłeczek wrote: > > Hi, > > I have the following foreign table: > > CREATE FOREIGN TABLE t1 ( > grouping_column text, > date_column date, > whatever_data int > ); > > The query is: > > SELECT

postgres_fdw aggregate pushdown for group by with expressions

2024-03-03 Thread Michał Kłeczek
Hi, I have the following foreign table: CREATE FOREIGN TABLE t1 ( grouping_column text, date_column date, whatever_data int ); The query is: SELECT sum(whatever_data) FROM t1 GROUP BY grouping_colulmn, extract(YEAR FROM date_column), extract(MONTH FROM date_column); From my (preli

Re: How should we design our tables and indexes

2024-02-10 Thread Michał Kłeczek
> On 10 Feb 2024, at 20:38, veem v wrote: > > Hello, > We want to have the response time in <1 sec for our UI search query > requirement. These will be pagination queries. These read queries will be on > big transaction tables (will have ~500+ attributes approx will have approx. > r

GIST index and ORDER BY

2023-10-09 Thread Michał Kłeczek
Hi All, Maybe somebody could help come up with an idea on how to resolve this. The situation is as follows: 1. We have a huge (10 billion rows) table with customer operations 2. It needs to be searched by several criteria at the same time - one of them is text similarity (and we decided to try