Long living and expiring locks?

2022-05-19 Thread Tim Uckun
I have multiple processes connecting to the same database. In order to prevent race conditions the I would like the process to issue a SELECT FOR UPDATE to lock the records that need to be processed. The problem is that the locks are not inside of a single translation. The process is multi step.

Resources on modeling ordered hierachies?

2022-04-06 Thread Tim Uckun
There a tons of articles about how to model hierarchies in SQL but I haven't seen any about dealing with hierarchies where the order of children is important. The canonical example is a simple outline 1. 1.1 1.1.1 1.2 2. 2.1 etc If I am doing an insert where parent is 1.1 it should name it 1.1.

Re: Indexes that would span partitions.

2022-03-15 Thread Tim Uckun
> How many partitions do you expect to have? Why are you partitioning on that > column? Do you have need to drop old data all at the same time? How many rows > in each partition or in total do you expect to have? In my case there is a hierarchy so the partitions are based on certain parts of the

Indexes that would span partitions.

2022-03-13 Thread Tim Uckun
What's a good strategy for dealing with indexes (multiple) that would span multiple partitions of a table. For example: Let's say I have a table that's partitioned by group_id because I want all the records for a group to be in the same partition. Let's say I have a field called "expires_at" whi

Re: Timestamp with vs without time zone.

2021-09-22 Thread Tim Uckun
Neil writes: > > > On Sep 21, 2021, at 12:34 PM, Dave Cramer > > wrote: > > On Tue, 21 Sept 2021 at 13:20, Peter J. Holzer wrote: > > > > On 2021-09-21 20:50:44 +1200, Tim Uckun wrote: > > > That's all true and I won't argue about the mad

Re: Re: Timestamp with vs without time zone.

2021-09-21 Thread Tim Uckun
That's all true and I won't argue about the madness that is timezones in the world. I am simply thinking it would be some sort of a struct like thing which would store the numerical value of the time stamp and also the time zone that time was recorded in. Presumably everything else is an insane ca

Re: Re: Re: Timestamp with vs without time zone.

2021-09-21 Thread Tim Uckun
Yes it would record the timestamp and then also record the time zone. That way all the conversion functions would still work. That's the way it works in the programming languages I use anyway. On Tue, Sep 21, 2021 at 8:09 PM Karsten Hilbert wrote: > > > > > It seems like it would be so much more

Re: Re: Timestamp with vs without time zone.

2021-09-21 Thread Tim Uckun
One specified by the user. Many date formats carry either an offset or the time zone information. On Tue, Sep 21, 2021 at 7:39 PM Karsten Hilbert wrote: > > > It seems like it would be so much more useful if the timestamp with > > time zone type actually stored the time zone in the record. > > W

Re: Timestamp with vs without time zone.

2021-09-21 Thread Tim Uckun
It seems like it would be so much more useful if the timestamp with time zone type actually stored the time zone in the record. On Tue, Sep 21, 2021 at 7:25 PM Laurenz Albe wrote: > > On Tue, 2021-09-21 at 18:00 +1200, Tim Uckun wrote: > > I am hoping to get some clarification on ti

Timestamp with vs without time zone.

2021-09-20 Thread Tim Uckun
I am hoping to get some clarification on timestamp with time zone. My understanding is that timestamp with time zone stores data in UTC but displays it in your time zone. Does this also work on queries? If I query between noon and 2:00 PM on some date in time zone XYZ does pg translate the query

Re: ALTER DATABASE SET not working as expected?

2021-09-09 Thread Tim Uckun
Ok thanks. On Thu, Sep 9, 2021 at 9:06 PM Ian Lawrence Barwick wrote: > > 2021年9月9日(木) 16:53 Tim Uckun : > > > > This seems simple enough but it's not working. > > > > alter database dbname set "blah.blah" = 'test_value' ; > > &

ALTER DATABASE SET not working as expected?

2021-09-09 Thread Tim Uckun
This seems simple enough but it's not working. alter database dbname set "blah.blah" = 'test_value' ; The above statement returns with no errors. select current_setting('blah.blah') The above statement returns a record with null Also how long does the "ALTER DATABASE SET" last? Will it surviv

Re: Choosing an index on partitioned tables.

2021-09-07 Thread Tim Uckun
There is an image marked as official: https://hub.docker.com/_/postgres I presumed this was maintained by the postgres team. On Tue, Sep 7, 2021 at 9:59 PM Magnus Hagander wrote: > > On Tue, Sep 7, 2021 at 11:52 AM Tim Uckun wrote: > > > > It's weird that it's sup

Re: Choosing an index on partitioned tables.

2021-09-07 Thread Tim Uckun
It's weird that it's supported on AWS and many other providers but not in the official docker images. On Tue, Sep 7, 2021 at 9:16 PM Magnus Hagander wrote: > > On Tue, Sep 7, 2021 at 10:51 AM Tim Uckun wrote: > > > > To be fair Timescale also adds some other featur

Re: Choosing an index on partitioned tables.

2021-09-07 Thread Tim Uckun
21 at 7:24 PM Laurenz Albe wrote: > > On Tue, 2021-09-07 at 04:06 +, Brent Wood wrote: > > From: Tim Uckun > > > My plan is to partition by date ranges which means the primary key has > > > to include the timestamp column and the id column As far as I know > &

Re: Choosing an index on partitioned tables.

2021-09-07 Thread Tim Uckun
Thanks! That's great about the Btree deduplication feature in 13. On Tue, Sep 7, 2021 at 7:21 PM Laurenz Albe wrote: > > On Tue, 2021-09-07 at 15:44 +1200, Tim Uckun wrote: > > I have a series of tables which are going to be queries mostly on two > > columns. A times

Re: Choosing an index on partitioned tables.

2021-09-06 Thread Tim Uckun
it of time based query > functionality. > > > Cheers > > Brent Wood > > Principal Technician, Fisheries > NIWA > DDI: +64 (4) 3860529 > > -- > *From:* Tim Uckun > *Sent:* Tuesday, September 7, 2021 15:44 > *To:* pgsql-general

Choosing an index on partitioned tables.

2021-09-06 Thread Tim Uckun
I have a series of tables which are going to be queries mostly on two columns. A timestamp table and a metric type column. My plan is to partition by date ranges which means the primary key has to include the timestamp column and the id column As far as I know there is no way to specify an index

Using functions in regexp replace captures

2021-08-04 Thread Tim Uckun
I want to do something like this SELECT REGEXP_REPLACE('some_string','(.*) (.*)',some_function_that_returns_string('\2',' \1')); Is this possible at all?

Re: Is there a way to dump schema to files on disk and keep them in sync

2020-12-13 Thread Tim Uckun
>pgAdmin does not create directories, it just organizes the contents of the system catalogs into GUI elements. I realize that :). I meant organized in the same way but on disk.

Re: Is there a way to dump schema to files on disk and keep them in sync

2020-12-13 Thread Tim Uckun
My primary use case for this is for development and experimentation, I have no intent on using it on production servers :) I normally use migrations for those. On Sun, Dec 13, 2020 at 9:04 PM Ron wrote: > > On 12/12/20 8:58 PM, Tim Uckun wrote: > > I want to dump my postgres schem

Is there a way to dump schema to files on disk and keep them in sync

2020-12-12 Thread Tim Uckun
I want to dump my postgres schema to disk in neat directories like pgadmin presents. Then I want to be able to edit the files and sync changes to the database and ideally if changes were made in the database to sync them back to the disk. Is there a tool that does this? Is there a tool that will d

pg_pass and pg_service

2018-10-04 Thread Tim Uckun
can I refer to a pg_service entry in the pgpass file? It seems silly to repeat all the information in the pgpass just to add the password. Alternatively can I put the user password in the pg_service file?

Pgadmin4 apt packages.

2018-03-04 Thread Tim Uckun
Where are the pgadmin4 apt packages? I have set up the PPA as specified on the download page but I see no pgadmin4 packages in the list. I am running ubuntu 17-10 but I had to set up the zesty PPA because there are apt repos for artfful.