Re: Pipeline Mode vs Single Row Mode / Chunked Rows Mode

2025-01-07 Thread Daniel Frey
> On 6. Jan 2025, at 20:47, Daniel Verite  wrote:
> 
> Daniel Frey wrote:
> 
>> I tried to understand the interaction between Pipeline Mode and
>> Single Row Mode / Chunked Rows Mode. It seems that it works
>> sometimes, but I don't get the feeling that it was deliberately
>> designed to work consistently
> 
> It's supposed to work, and there are regression tests in
> src/test/modules/libpq_pipeline/libpq_pipeline.c [1]
> that exercise the single row mode and PQpipelineSync().
> 
> You might want to compare your code workflow with how it's done in
> that file, and maybe submit a bug report with your test case if the
> conclusion is that your code should not error out.

Thank you for the link, I will need some time to investigate and to figure out 
what is different.

Best, Daniel





Re: Postgres do not support tinyint?

2025-01-07 Thread Igor Korot
Hi, Ron,

On Tue, Jan 7, 2025 at 11:24 PM Ron Johnson  wrote:
>
> On Wed, Jan 8, 2025 at 12:06 AM Igor Korot  wrote:
>>
>> Hi, ALL,
>> According to https://www.postgresql.org/docs/9.1/datatype-numeric.html, the
>> smallest numeric type supports numbers from -32768 to 32767/
>>
>> My data will be in a range of [0..4], and so I guess my DB table will waste
>> space, right?
>
>
> 1. It's not 1994 anymore, when 8M rows was enormous.
> 2. Record structures are padded by word size, so tinyint wouldn't matter 
> unless you specifically ordered the fixed width columns from largest to 
> smallest size when creating the table.
> 3. The "bit" type might serve your needs.

 I don't see the "bit" field here:
https://www.postgresql.org/docs/current/datatype-numeric.html...

Thank you..

>
> --
> Death to , and butter sauce.
> Don't boil me, I'm still alive.
>  lobster!




Re: Postgres do not support tinyint?

2025-01-07 Thread Christophe Pettus



> On Jan 7, 2025, at 22:26, Igor Korot  wrote:
> I don't see the "bit" field here:
> https://www.postgresql.org/docs/current/datatype-numeric.html...

https://www.postgresql.org/docs/current/datatype-bit.html




Postgres do not support tinyint?

2025-01-07 Thread Igor Korot
Hi, ALL,
According to https://www.postgresql.org/docs/9.1/datatype-numeric.html, the
smallest numeric type supports numbers from -32768 to 32767/

My data will be in a range of [0..4], and so I guess my DB table will waste
space, right?

Thank you.




Re: Postgres do not support tinyint?

2025-01-07 Thread Adrian Klaver

On 1/7/25 21:06, Igor Korot wrote:

Hi, ALL,
According to https://www.postgresql.org/docs/9.1/datatype-numeric.html, the
smallest numeric type supports numbers from -32768 to 32767/


In this case it does not matter, but you should not consult 
documentation that is for a version(9.1) that is ~8 years past EOL.


Go here:

https://www.postgresql.org/docs/

and click on Current or the version you are actually using.



My data will be in a range of [0..4], and so I guess my DB table will waste
space, right?


Yes, though is that actually going to be an issue?



Thank you.




--
Adrian Klaver
adrian.kla...@aklaver.com





Re: Postgres do not support tinyint?

2025-01-07 Thread Ron Johnson
On Wed, Jan 8, 2025 at 12:06 AM Igor Korot  wrote:

> Hi, ALL,
> According to https://www.postgresql.org/docs/9.1/datatype-numeric.html,
> the
> smallest numeric type supports numbers from -32768 to 32767/
>
> My data will be in a range of [0..4], and so I guess my DB table will waste
> space, right?
>

1. It's not 1994 anymore, when 8M rows was enormous.
2. Record structures are padded by word size, so tinyint wouldn't matter
unless you specifically ordered the fixed width columns from largest to
smallest size when creating the table.
3. The "bit" type might serve your needs.

-- 
Death to , and butter sauce.
Don't boil me, I'm still alive.
 lobster!


Re: Postgres do not support tinyint?

2025-01-07 Thread David G. Johnston
On Tuesday, January 7, 2025, Ron Johnson  wrote:

>
> 3. The "bit" type might serve your needs.
>
>
You suggest a type with a minimum size of 6 bytes when the complaint is
that the otherwise acceptable 2 byte data type is too large?

David J.


Re: Postgres do not support tinyint?

2025-01-07 Thread Christophe Pettus



> On Jan 7, 2025, at 22:44, David G. Johnston  
> wrote:
> 
> You suggest a type with a minimum size of 6 bytes when the complaint is that 
> the otherwise acceptable 2 byte data type is too large?

Although it's not clear from the OP's question, if there are going to be a 
significant number of these 3-bit fields, packing them into a bitstring might 
be a way forward.  It's a good solution for tables with a ton of booleans.



Re: Postgres do not support tinyint?

2025-01-07 Thread Tom Lane
"David G. Johnston"  writes:
> On Tuesday, January 7, 2025, Ron Johnson  wrote:
>> 3. The "bit" type might serve your needs.

> You suggest a type with a minimum size of 6 bytes when the complaint is
> that the otherwise acceptable 2 byte data type is too large?

I think the point here is that there's zero value in trying to pack a
small integer value into 1 byte (let alone 4 bits) if it's all by
its lonesome in the row.  Alignment padding will eat whatever gain
you thought you had.  If you want a win, you need to store a lot of
such values in one field.  Ron's suggesting that you pack them into
bit arrays and manually insert/extract individual values.  That could
be worth doing if you were sufficiently desperate, but you'd have to
value compact storage over access simplicity quite a lot.

Perhaps a "char"[] array (note the quotes) would provide an
intermediate level of compactness versus pain.

regards, tom lane