When running a program that converts data from an old, obscure database to PostgreSQL using Aurelius, I noticed the conversion took more time then I expected.
After ruling out the obvious reasons (indexes etc.) I used a profiler that showed me that the program did a lot of lookups on a particular table like this:
var
nBedrijfImportID: Int64;
bedrijven: Tbedrijven;
OM: TObjectManager;
bedrijven:=OM.Find<TBedrijven>.Add(TExpression.Eq('importid',nBedrijfImportID)).UniqueResult;
The field importid is indexed, so in my opinion this lookup should be very quick, but it took more than 10 ms on a local database.
Is this the best way to get fast results (with UniqueResult) or is it better to use conventional queries?