On Tue, 4 Jul 2006, Marc Weustink wrote:

> Joost van der Sluis wrote:

> /me just jumping in, so might probably completely clueless
> 
> > If you open the table, the postgresql-client will allocate some memory
> > to store the data. That'll be 10+8=18 bytes plus something dependent on
> > it's own string-data-format.
> > At the same time TBufDataset will allocate memory for FPacketRecords
> > (default=10) records. Thus: 10*(8192+8192)=163840 bytes.
> > And TDataset will allocate memory for Buffercount (default=10)*(8192
> > +8192)=163840 bytes.
> > 
> > So, that'll be: 327698 bytes for the two records.
> > If you fetch more records, only the postgresql-client and TBufDataset
> > will allocate more memory, but you can do that math yourself.
> > 
> > Now, what if the fields were varchar(100); (ridiculous high, but even
> > then...) 18+10*(100+100)+10*(100+100)=2018 bytes.
> > 
> > So, by defining a limit on the varchar, you've gained 325680 bytes of
> > memory.
> > 
> > I think that this little example shows the problem pretty well...
> > 
> > btw: only postgresql supports unlimited varchar's.
> 
> isn't it like an Oracle CLOB or Access memo ?

Yes, you could compare them. Except that they are handled completely
differently by sqldb. If you need large objects, you'd better use a
BLOB-field, like Oracls's CLOB or a memo-field. Postgres however doesn't
support those, they have their own LOB-handling mechanism. Which is quite
nice. You store a unique number in the table, and than you can load the
binary object from the database with that number.
Too bad that sqldb can't detect from a number if there's a LOB attached to
it, so the developer has to handle that himself.

> Didnt' the bde have a limit on varchar sizes and threating every varchar 
>  > 256 as a blob ?

Maybe the bde did, but dbexpress doesn't. Maybe we could implement that if
the varchar>dsMaxStringSize it becomes a blob?

But if you have a good db-design, you woudn't need this all, imho.

But I'm in favour of adding a new field-type: ftVarchar. That field could
store it's values in a ansistring. So that no unnessecary memory is
allocated. I though that I suggested that earlier, but Michael had some
thoughts about this. Can't remember them, though.

Joost. 

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to