timetz need more bytes than timestamptz

2023-06-18 Thread jian he
Hi,
https://www.postgresql.org/docs/current/datatype-datetime.html
timetz, timestamptz:
same resolution.
fractional digits in the seconds field are also the same.
>
> All timezone-aware dates and times are stored internally in UTC. They are
converted to local time in the zone specified by the TimeZone configuration
parameter before being displayed to the client.

Why does timetz need more bytes (8 vs 12) than timestamptz?


Re: Question: Multiple pg clusters on one server can be reached with the standard port.

2023-06-18 Thread Thomas Markus

Hi,

Am 16.06.23 um 13:53 schrieb Brainmue:



possible solutions:
* set up a firewall rule to forward connection
* use a tcp proxy (nginx can do that)
* check pg_bouncer

best regards
Thomas

Hello Thomas,

Thank you for your quick reply.

With firewall you mean an additional software, right?
Because with iptables or netfilter I can't forward TCP packets based on the DNS 
alias name. Or is
that possible?

I have the same problem with nginx. I just looked in the documentation again 
but I can't find a way
to distinguish which cluster to forward to based on the DNS alias.
Do you have an example for me?

We have already looked at pgbouncer and it works with that but unfortunately 
you have to do the
authentication in pgbouncer. Which we don't like so much.

Regards,
Michael


You cant setup firewall rules basedon dns names. firewall rules are 
based on ip adresses and dns resolution happens on rule creation.
I dont have an example for nginx. As I remember nginx resolves dns names 
only for variables. So setup a variable with your hostname and use this 
variable in your server definition.


best regards
Thomas



OpenPGP_0x9794716335E9B5AF.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


Re: timetz need more bytes than timestamptz

2023-06-18 Thread Junwang Zhao
timetz stores only the time units within a day, it uses an extra field
to store the zone info.

typedef int64 TimeADT;
typedef struct
{
TimeADT time; /* all time units other than months and years */
int32 zone; /* numeric time zone, in seconds */
} TimeTzADT;

timestamp is a count that starts on January 1st, 1970 at UTC.

You can convert a timestamp to any timezone, but not timetz.

On Mon, Jun 19, 2023 at 11:53 AM jian he  wrote:
>
>
> Hi,
> https://www.postgresql.org/docs/current/datatype-datetime.html
> timetz, timestamptz:
> same resolution.
> fractional digits in the seconds field are also the same.
> >
> > All timezone-aware dates and times are stored internally in UTC. They are 
> > converted to local time in the zone specified by the TimeZone configuration 
> > parameter before being displayed to the client.
>
> Why does timetz need more bytes (8 vs 12) than timestamptz?



-- 
Regards
Junwang Zhao