GDA: empty PostgreSQL table failed workaround

Mark Johnson mrj001 at
Thu Feb 14 20:00:48 EST 2008

Graham Leggett wrote:
> Derek Atkins wrote:
>> I think the question was more:  Does every table have to HAVE
>> a primary key?  Yes, the primary key must be unique, but what
>> if a table has no primary key?  Is that still okay?
> It's perfectly ok, yes - but primary keys are used heavily for 
> optimisation. Without them, performance will suffer, particularly 
> while generating reports.
> Regards,
> Graham
> -- 
Only if the primary key is, in fact, on a field used to look records up 
for reports.  In this case (slots and recurrences), the primary key 
field was constructed only for the purpose of being a primary key.  To 
my knowledge, it is not actually used to look up any records. 

I am going to try creating secondary (not primary) indices on other 
fields and see how that affects MySql's performance in the register 
opening queries.  In the case of slots, this will be the obj_guid 
field.  This is NOT unique and because an object can have many slots.  
Therefore, it cannot be a primary key.  However, it can improve 

I am also going to try creating a secondary index on the 
splits.account_guid field.  Also not unique.  It is used in the register 
opening queries to look up splits.

I expect these two indices will improve performance.  I'm just not sure 
it will be enough for the sub-query forms of the queries to provide 
acceptable performance on MySql.


More information about the gnucash-devel mailing list