[Bucardo-general] Design of new txntime field

Jon Jensen jon at endpoint.com
Fri Nov 6 14:35:37 UTC 2015


On Fri, 6 Nov 2015, Greg wrote:

> greg=# select to_char(current_timestamp,'YYYY-MM-dd.HH24:MI:US ') ||
> pg_backend_pid();
>            ?column?
> -------------------------------
>  2015-11-06.08:35:460738 10638

That's missing seconds, though, which are pretty important. :) I think 
you'd want:

select to_char(current_timestamp,'YYYY-MM-dd HH24:MI:SS.US ') ...

Ioana wrote:

> In our database, we have 2 big tables and one of them that has about 300 
> million records has an index on a text field that has 16-20 characters. 
> When I have to restore a backup of the database that index takes 10 
> times longer than any other index. I know the delta and track table 
> won't get that big so it might not be a problem for this app. How about 
> using 2 fields in the primary key. One the current txntime field and one 
> a serial id field.

I'm guessing that the varchar version would take way more disk space, and 
the index would be way bigger and slower.

So I too wonder whether a composite 2-field primary key would be better.

For the sake of completeness do we need to discuss the likelihood of 
getting the same PID at the same microsecond from two different machines? 
:)

Jon


-- 
Jon Jensen
End Point Corporation
https://www.endpoint.com/


More information about the Bucardo-general mailing list