agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Rob Sargent <robjsargent@gmail.com>
To: pgsql-sql@lists.postgresql.org
Subject: Re: Storing thousands of csv files in postgresql
Date: Tue, 15 Feb 2022 14:13:30 -0700
Message-ID: <9abb8f15-001e-8aa8-d930-fe5af71f829c@gmail.com> (raw)
In-Reply-To: <CAJexoSJwEKFLLuD=LHfHX-+yiaOBD3a8MWG3f969T_FWirj36A@mail.gmail.com>
References: <CANbgw4BfmAUsMTsh0z2Y-97jusZObaC+Ez7Mm=papd-WUDd89A@mail.gmail.com>
	<CAJexoSL-RADZAFFtW6NgGNg+SiomNwvcApWpogwuW3EsdGHJXA@mail.gmail.com>
	<CANbgw4D-fkNPwqoh95yJn7jtVsty8NbBMSBME0S5qVHi-43OeA@mail.gmail.com>
	<CAJexoSJwEKFLLuD=LHfHX-+yiaOBD3a8MWG3f969T_FWirj36A@mail.gmail.com>


> I don't think you need a "federated" postgres network like Citus at 
> all - I think this solves a different use case. For your design 
> problem, I think that having a bunch of independent Pg servers would 
> be fine - as long as you don't need to run searches across CSV tables 
> stored across different databases (in which case you do need 
> index/search federation of some kind).
>
> Regarding Erik Brandsberg's point about XFS, I think this is a useful 
> alternative approach, if I understand the idea. Instead of storing 
> your CSV files in Postgres, just store them as CSV files on the file 
> system. You can still store the schemas in Pg, but each schema would 
> just point to a file in the file system and you'd manipulate the files 
> in the filesystem using whatever language is appropriate (I find ruby 
> to be excellent for managing CSV files). If you need to index those 
> files to run searches against them, I'd direct your attention to 
> https://prestodb.io/ which is the core technology that runs Amazon 
> Athena. This allows you to search CSV files with various schema (among 
> other data bindings). So you might find that Pg as your schema 
> storage, XFS (or any modern FS) to store large numbers of CSV files, 
> and Presto/Athena to index/search those files, along with some CSV 
> management language (like Ruby or something even higher level) to 
> manage the data.
>
> I think if I were dealing with less than 10k CSV files (and therefore 
> Pg tables), I might use Pg, and if I were dealing with 10k+ files, I'd 
> start looking at file systems + Presto. But that's a WAG.
>
> Steve
>
>
I think the add/remove column requirement alone justifies NOT using 
files.  The CSV approach will temp the system to handle some versioning 
nonsense. Using tables also provides some protection against the 
inevitable garbage data in the CSVs.

view thread (14+ messages)  latest in thread

Message-ID: <9abb8f15-001e-8aa8-d930-fe5af71f829c@gmail.com>
Permalink:  ../9abb8f15-001e-8aa8-d930-fe5af71f829c@gmail.com/
Also on:    postgresql.org/message-id/9abb8f15-001e-8aa8-d930-fe5af71f829c@gmail.com

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-sql@postgresql.org
  Cc: robjsargent@gmail.com, pgsql-sql@lists.postgresql.org
  Subject: Re: Storing thousands of csv files in postgresql
  In-Reply-To: <9abb8f15-001e-8aa8-d930-fe5af71f829c@gmail.com>

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

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