On Wed, Jan 25, 2012 at 4:07 PM, Richard Hipp <d...@sqlite.org> wrote:

> On Wed, Jan 25, 2012 at 4:01 PM, John Elrick <john.elr...@fenestra.com
> >wrote:
>
> > Much better.  I wasn't sure which version to incorporate the changes into
> > (the link is to the source), so I put them into 3.7.9.
> >
> > The total mallocs have dropped to 1.5 million -- twice as high as 3.7.5
> but
> > in line.  I'll have to run some additional performance testing but
> visually
> > the system appears to be a lot closer to expected.
> >
> > What was going on? (My client will want a report on the resolution).
> >
>
> The SQLite byte-code engine was being too conservative and was reparsing
> the schema in places where it was not strictly necessary.  The fix was to
> restrict the places where the schema was reparsed to situations that really
> needed it.
>
> I cannot give more detail without seeing your application, since I still
> don't know exactly what you are doing to trigger the excess reparsing.  The
> patch above comes from a script of my own that I finally managed to put
> together that caused unnecessary schema reparsing.  It took a specific
> combination of events:  A schema change inside of a transaction followed by
> DML statements that had been prepared prior to the schema change.
>
>
My brain missed that.   The sequence I described should have been:

prepare query1
prepare query2
begin transaction
create something -> schema change
query1.step
  - schema invalid so recreate
  - recreation of schema changes the generation
query2.step
  - schema invalid so recreate
  - recreation of schema changes the generation
query1.step
  - schema invalid so recreate
  - recreation of schema changes the generation
query2.step
  - schema invalid so recreate
  - recreation of schema changes the generation
end transaction

...which I believe describes your scenario perfectly.  Odd that the script
didn't replicate it, since it should have had the nested transactions as
well.

Thank you very much for your assistance Richard.  I sincerely appreciate it.

Thanks to everyone else who helped guide me on this investigation.


John
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to