Re: Wrapping a where clause to preserve rows with nulls

2024-12-18 Thread Adrian Garcia Badaracco
l) OR false OR true -> WHERE false OR false OR true -> true. That's still a pretty good solution for now. On Wed, Dec 18, 2024 at 10:41 PM Adrian Garcia Badaracco < adr...@adriangb.com> wrote: > Thank you for the great idea Tom. While yes I can't modify the original &g

Re: Wrapping a where clause to preserve rows with nulls

2024-12-18 Thread Adrian Garcia Badaracco
least not without re-implementing a bunch of finicky error prone code). On Wed, Dec 18, 2024 at 10:38 PM Tom Lane wrote: > "David G. Johnston" writes: > > On Wednesday, December 18, 2024, Adrian Garcia Badaracco < > > adr...@adriangb.com> wrote: > >> Is there

Re: Wrapping a where clause to preserve rows with nulls

2024-12-18 Thread Adrian Garcia Badaracco
ed, Dec 18, 2024 at 9:47 PM Adrian Garcia Badaracco wrote: > I have a query where I have to run a where clause generated by another > system (i.e., I can't modify that where clause. The where clause may return > `null`, but I actually want to keep rows that return `null` (and rows tha

Wrapping a where clause to preserve rows with nulls

2024-12-18 Thread Adrian Garcia Badaracco
I have a query where I have to run a where clause generated by another system (i.e., I can't modify that where clause. The where clause may return `null`, but I actually want to keep rows that return `null` (and rows that return `true` but not rows that return `false`). I thought it would be as s

Faster `&&` intersection for sorted arrays

2024-09-28 Thread Adrian Garcia Badaracco
I was wondering if I could do better than `&&` for sorted arrays by doing binary search and came up with some really interesting results. I only did a quick spin of this, an LLM generated most of the code after I gave it the algorithm and I don't plan on using it in production (I'm going to normali

Re: Compressing large column by moving it to a unique table

2024-02-13 Thread Adrian Garcia Badaracco
rt_timestamp > ('2024-01-01 00:00:00.00+00'::timestamptz + interval '1 day') AND start_timestamp < ('2024-01-01 00:00:00.00+00'::timestamptz + interval '2 day') ); -- https://app.pgmustard.com/#/explore/47ef84f0-a96e-4baa-af40-2ec241cbb6e2 ``` On Tue, F

Re: Compressing large column by moving it to a unique table

2024-02-13 Thread Adrian Garcia Badaracco
the practical aspects, in particular that case of selecting a subset of columns from the view that I know doesn’t need the join but the query planner thinks does. On Tue, Feb 13, 2024 at 3:16 AM Ron Johnson wrote: > On Mon, Feb 12, 2024 at 10:12 PM Adrian Garcia Badaracco < > adr...@adriang

Compressing large column by moving it to a unique table

2024-02-12 Thread Adrian Garcia Badaracco
I am using Timescale so I'll be mentioning some timestamp stuff but I think this is a general postgres question for the most part. I have a table with some fixed, small columns (id, timestamp, etc) and a large JSONB column (let's call it `attributes`). `attributes` has 1000s of schemas, but given