Thread: Convert OID intergers to path strings.

Convert OID intergers to path strings.

From
fulan Peng
Date:
Hi, committers!

I am naive for postgresql. I have millions of tiny databases. When I
was trying to createdb, it fails because each database is saved in
$PG_DATA/base/Oid.  In UFS system, one directory maximum can hold
32768 subdirectories.

Oid is 4 byte integer. Subdirectory is a path name with maximum 32768
variations.  Use Oid as a directory name to save object is not a good
practice because they are different object.

For myself, I want to make 2 functions Oid2Dir and Dir2Oid. For example:

Oid                        Dir                      Object Location
1                       00/00/00/01            00/00/00/01/1
10                     00/00/00/0A            00/00/00/0A/10
255                   00/00/00/FF             00/00/00/FF/255
65535               00/00/FF/FF              00/00/FF/FF/65535
....                      ....                             ....
4294967285     FF/FF/FF/FF                 FF/FF/FF/FF/4294967285

This is the way you guys can map all of your objects on disk without
worry of break the limitation of the file system.
This will make postgresql one more reason better than mysql. I wish
someone would help me.

Re: Convert OID intergers to path strings.

From
Joshua Tolley
Date:
On Sun, Sep 13, 2009 at 06:06:11PM +0000, fulan Peng wrote:
> Hi, committers!
>
> I am naive for postgresql. I have millions of tiny databases. When I
> was trying to createdb, it fails because each database is saved in
> $PG_DATA/base/Oid.  In UFS system, one directory maximum can hold
> 32768 subdirectories.

The pgsql-hackers mailing list is a better place for this discussion, and the
first time you emailed about this problem the hackers list responded. See
http://archives.postgresql.org/pgsql-hackers/2009-09/msg00731.php for details.
Feel free to continue the discussion on that thread if you wish.

--
Joshua Tolley / eggyknap
End Point Corporation
http://www.endpoint.com

Attachment