[Lazarus] Postgres database again...

Graeme Geldenhuys graemeg.lists at gmail.com
Tue May 27 15:46:20 CEST 2008


Damien Gerard wrote:
> Your app should not never be dependant of Primary keys.
> Finding the good id should be the work of you DB and not your app.

My app does not create the primary keys, it's the job of the Object 
Persistence Layer (tiOPF) that I use.  Each business object (descendant 
of TtiObject) has a OID: TtiOID property. The developer can register 
what OID Manager to use (Strings, GUID, Integer, Int64 etc) You can even 
mix them (multiple OID Managers) in a single application.

The OPF manages the loading and persisting of my business objects. I 
simply call Load or Save. Even if I switch the backend storage from MS 
SQL Server to Firebird (or even CSV, Tab Files, XML, DBF etc), it makes 
no difference in my code. The process of loading/saving the data stays 
the same.

I also use proxy objects (I think that's what you call it). I load a 
'lite' version of my objects (to conserve memory) and only load the 
'full' remainder of the data per object when needed. So having many 
concurrent users with a large database doesn't cause much problems. We 
don't keep everything in memory, we free things off when not needed.

> I agree others DB than postgres have not all required features but  
> they have their own one.

And with a product as popular as MS SQL Server, @@identify is a 
nightmare. Knowing you have a guaranteed unique ID from the start is a 
big plus.

> It is not really a problem of disk usage (even if I disagree here :  
> INT4/INT8 vs CHAR(36) * RowCount ...) but when you have huge data  
> databases, milliseconds are (very) important and you can not afford to  
> use indexes on varchar/char (whatever the DB is)

When you have database tables with a couple million records you quickly 
learn never ever to do a 'select * from tablename'. You quickly become 
very specific with what data you need and only return that.


But now I'm lost... I can't remember what this original thread was 
about... ;-)


Regards,
   - Graeme -


_______________________________________________________
fpGUI - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/





More information about the Lazarus mailing list