REINDEX

Florian Bogeschdorfer fb at memedia.de
Tue Aug 30 09:46:22 CDT 2005


> 
> If Flush() the most important tool for preventing database corruption?
> How often should I Flush()?  After every insert or ALTER or DELETE?
> Should I build into my main db parent object a process that keeps track
> of the number of changes and then run Flush() after a certain number of
> changes?
> 
> How do you handle this, Florian?
> 

Well, first of all, I do not use the SQL way to delete records, - I use the
API way. But I am not that familiar with SQL like you look to be

> CREATE TABLE answers (
    qRecId ObjectPtr REFERENCES questions ON DELETE CASCADE NOT NULL INDEXED
     ...

Looks very complicated to me. Why not try the API way (build cursor,
deleteAllRecords(cursor)) and see if your problem goes away...?

About Flush: if I change or delete single records every now and then, I
regularly do a FLUSH after each change in DB. This is built in my handlers.
Why? Because this gives me the most safety and it does not take long. 

But if I change or delete hundreds or thousands of records in a row, I have
seen problems (at least with vServer) with the DB connection, so I made a
special handler for this, FLUSHing only every 1000 records and at the end of
the job. This is much faster anyway if you deal with so many records.

Hope that helps, Florian



More information about the Valentina mailing list