pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: JP Pozzi <jpp@jppozzi.dyndns.org>
To: Ron <ronljohnsonjr@gmail.com>
Cc: pgsql-admin <pgsql-admin@lists.postgresql.org>
Subject: Re: Big table and partition
Date: Sun, 15 Oct 2023 23:13:47 +0200 (CEST)
Message-ID: <1688850455.1480.1697404427434.JavaMail.zimbra@jppozzi.dyndns.org> (raw)
In-Reply-To: <b161e000-3b9f-4097-9094-ff1a301ed99a@gmail.com>
References: <CAJk5AtYv5x9_j9HtRtt_7JE-p-Fs2sA_kb2u4fbNcwwsqNVqMQ@mail.gmail.com>
	<c2dcb0ce-9172-438d-a754-557bfd55f0f2@dalibo.com>
	<CAJk5AtbY+-viwdX5Gor7nwcY8QpEjGTW28uLBwMKLxSVtOxPfA@mail.gmail.com>
	<b161e000-3b9f-4097-9094-ff1a301ed99a@gmail.com>

Hello, 

Partitionning is not so simple, it is better to have a key (or part of key) or a date to make 
useful partitionning decision. 
If you want to suppress (or archive and suppress) some data it is simple to "drop" a whole 
partition. Also if the partitionning key (or part ok key) is in most queries it is a good solution 
for better performance. 

Regards 

JP P 


De: "Ron" <ronljohnsonjr@gmail.com> 
À: "pgsql-admin" <pgsql-admin@lists.postgresql.org> 
Envoyé: Dimanche 15 Octobre 2023 23:03:49 
Objet: Re: Big table and partition 

On 10/15/23 15:46, Rajesh Kumar wrote: 



The columns are id, blocknumber and jsondata. 



No date column? 

How much json data? 


BQ_BEGIN


I have not been told anything ABT data retention and I will ask them. 

Problem I am trying to resolve is, 30gb is big 

BQ_END

Big is relative. 30GB in 2023 is pretty darned small. 


BQ_BEGIN

and it will be every growing always. By doing this, i am making the scan easier (despite having indexes). 

Growth will be 10gb per year data. 

BQ_END

That's less than a gigabyte per month. 


BQ_BEGIN


Incase I am doing partition, Plz provide any script that does partitioning automatically. We are using postgres version 15. 

BQ_END

Keep It Simple, Stanley and just DELETE WHERE id < nnnnnnn ; . Do that every month. 


BQ_BEGIN


On Sun, 15 Oct, 2023, 8:07 PM Christophe Courtois, < [ mailto:christophe.courtois@dalibo.com | christophe.courtois@dalibo.com ] > wrote: 

BQ_BEGIN
Hi, 

Le 14/10/2023 à 22:46, Rajesh Kumar a écrit : 
> In my env, I have a table 30GB where data is getting inserted directly 
> whenever the new block is created in block chain... 
> I have been asked to do partition, i said manager since we are not at 
> all using the past data, partition is not required. Instead we can stop 
> the sync (downtime not required), change the name of table , create a 
> new table with same structure with original name and keep only tis month 
> data. Then sync the blockchain so that new data will come to newly 
> created table and old data will be there simply as a storage as we r not 
> selecting any query from old data... 

In fact, you want to do manual partitioning. 
Why reinvent the wheel? 

> Note: on a longer run, data will keep on coming in whenever new block is 
> created. 
> Is that right ? Any suggestions ? Better options ? 

What problem do you have to solve? 30 GB is not so big, but since when 
do you store data? Will you purge the table? What is the main access key 
of your queries (critical for the partitioning key)? 

Without other information I'd say that if you never read the former 
months again, partition by month, perhaps by year. 

-- 
Christophe Courtois 
Consultant DALIBO 

BQ_END


BQ_END

-- 
Born in Arizona, moved to Babylonia. 

view thread (10+ messages)  latest in thread

Message-ID: <1688850455.1480.1697404427434.JavaMail.zimbra@jppozzi.dyndns.org>
Permalink:  ../1688850455.1480.1697404427434.JavaMail.zimbra@jppozzi.dyndns.org/
Also on:    postgresql.org/message-id/1688850455.1480.1697404427434.JavaMail.zimbra@jppozzi.dyndns.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: jpp@jppozzi.dyndns.org, ronljohnsonjr@gmail.com, pgsql-admin@lists.postgresql.org
  Subject: Re: Big table and partition
  In-Reply-To: <1688850455.1480.1697404427434.JavaMail.zimbra@jppozzi.dyndns.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox