Re: [OT] PostgreSQL: bytea help needed.

From: mlw (mlw_at_nospam.no)
Date: 02/04/05


Date: Thu, 03 Feb 2005 22:21:44 -0500

Mike Cox wrote:

> mlw <mlw@nospam.no> writes:
>
>> Mike Cox wrote:
>>
>> > Christopher Browne <cbbrowne@acm.org> writes:
>> >
>> >> Centuries ago, Nostradamus foresaw when Mike Cox
>> >> <mikecoxlinux@yahoo.com> would write:
>> >> > Does anyone know how to add data to a bytea in PostgreSQL? I
>> >> > googled
>> >> > the archives, and they mostly talk about PHP. I'd like to put
>> >> > binary data in the bytea from my local filesystem, but google comes
>> >> > up empty other than using PHP.
>> >>
>> >> Well, you draw the data in, and then append it to the field.
>> >
>> > Well this is elementary stuff. Lets say I wanted to pull a jpg into
>> > the database from my local filesystem for example.
>>
>> My first reaction would be to say you are insane. Using a database as a
>> file system isn't its best used.
>
> You are wrong about this. I'm already using it for every text
> document, html page via the COPY command. My goal is to have a WinFS
> like filesystem on linux machine. You cannot believe how much better
> having all my data stored in a database is. I used to have my home
> directory cluttered with various data. It was a complete mess.

No, you just moved the clutter to a system which has fewer tools for
managing it.

>
> Now I just do an SQL search and BAM! I get exactly what I want. It
> gets even better when you have the tsearch2 from PostgreSQL Contrib
> installed. It is like google search squared!

I actually have a text search engine for Linux. It creates a full text
search index with soundex, metaphone, and logical operations. It *is* like
google for the desktop.

>
> Now I can search for different types of critera with the speed of an
> SQL database engine.

Yes and no. Don't get me wrong, it sounds like fun, but I'm not convinced
that you are using the best tools for the desired solution. A database is
good, and there are some very cool advantages to using it the way you are,
but depending on your application, you can do much better by leaving the DB
to handle the "information" and the file system to handle the files.

>
>>I would store the file path and name and have a
>> separate volume or directory for the image. Especially if you are using
>> large images.
>
> Nah. I want to be able to do image matching for similar images, mp3s,
> etc.

Unless you are talking about the tags in the MP3 file, you need some
sophisticated (and time consuming) algorithms to do "sounds like" searches.
If you are talking about the mp3 tags, it would be trivial to store the
tags in the database along with the filename.

> If you can specify something with the "like" command to find similar
> binary data, it would be totally awesome. WinFS on my desktop years
> before Longhorn EVER comes out with it.



Relevant Pages

  • Re: Treads in the new 6 core CPU from Intel
    ... Why do you think six cores are "fighting" for resources? ... implications of an asymmetric I/O bus structure on file system I/O? ... Why do you think the file I/O is not taking advantage of the File System Cache? ... What, in fact, do you mean by the phrase "database ...
    (microsoft.public.vc.mfc)
  • Re: Question regarding to store file system metadata in database
    ... database based file system will be useful for archiving. ... but 300 metadata iops is not that fast. ... feature needed by file system is really a small part of database ...
    (Linux-Kernel)
  • Re: If you were inventing CoBOL...
    ... >> The underlying file system is irrelevant. ... The database would work exactly the same. ... tree nodes lived in a table. ... >Well bang goes the only advantage of lists and trees, ...
    (comp.lang.cobol)
  • Re: Question regarding to store file system metadata in database
    ... I agree that people always want to access metadata faster. ... Anybody know how fast a file system can do pathname-to-inode ... am just proposing to store pathanem-to-inode number in database. ... For example, one can setup a database to store file pathname, its ...
    (Linux-Kernel)
  • Re: Question regarding to store file system metadata in database
    ... database can reside on a raw block device. ... but 300 metadata iops is not that fast. ... database based file system could be a secondary file system but ... feature needed by file system is really a small part of database ...
    (Linux-Kernel)