mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
performance fix
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@4979 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
bcf49d693d
commit
4bfdb526d2
@ -481,8 +481,23 @@ pgendRunQuery (Backend *bend, Query *q)
|
||||
|
||||
/* stage transactions, save some postgres overhead */
|
||||
xaccGroupBeginStagedTransactionTraversals (be->topgroup);
|
||||
|
||||
/* We will be doing a bulk insertion of transactions below.
|
||||
* We can gain a tremendous performance improvement,
|
||||
* for example, a factor of 10x when querying 3000 transactions,
|
||||
* by opening all accounts for editing before we start, and
|
||||
* closing them all only after we're done. This is because
|
||||
* an account must be open for editing in order to insert a split,
|
||||
* and when the commit is made, the splits are sorted in date order.
|
||||
* If we're sloppy, then there's an ordering for every insertion.
|
||||
* By defering the Commit, we defer the sort, and thus save gobs.
|
||||
* Of course, this hurts 'shallow' queries some, but I beleive
|
||||
* by not very much.
|
||||
*/
|
||||
ncalls = 0;
|
||||
xaccAccountGroupBeginEdit(be->topgroup);
|
||||
pgendFillOutToCheckpoint (be, sql_query_string);
|
||||
xaccAccountGroupCommitEdit(be->topgroup);
|
||||
PINFO ("number of calls to fill out=%d", ncalls);
|
||||
|
||||
sql_Query_destroy(sq);
|
||||
|
Loading…
Reference in New Issue
Block a user