System.Data.SQLite
View Ticket
Not logged in
Ticket UUID: 1eacbf5ad9c039a1b618d08c54dd52ce78bf501b
Title: Trace showing single delete multiple times
Status: Closed Type: Question
Severity: Minor Priority: Medium
Subsystem: Native_Assembly Resolution: Works_As_Designed
Last Modified: 2019-02-01 00:14:27
Version Found In: 1.0.109.0
User Comments:
anonymous added on 2019-01-31 16:25:39: (text/x-fossil-plain)
I registered the Trace event of the SQLiteConnection. 
For insert and update statements, it is triggered one time per statement.
For delete, it is called multiple times.

I found out that it seems to be related with foreign keys. If they are enabled, and another table has a foreign key reference to this table, the Trace is called multiple times, even if cascading does not delete anything in the other table. The statement shown in the TraceEventArgs is always the same (e.g. "DELETE FROM TableX WHERE ID = 1").

I find this a bit confusing, especially since I did not find any documentation about this.
Is this behaviour intended?

mistachkin added on 2019-02-01 00:14:27: (text/x-fossil-plain)
This behavior is by design and originates from inside the SQLite core library.

More details can be found here:

[https://www.sqlite.org/c3ref/profile.html]

If you still believe the behavior is not as described, please feel free to open
another ticket or send a message to the "sqlite-users" mailing list:

[https://system.data.sqlite.org/index.html/doc/trunk/www/support.wiki]

If you open another ticket, please give the specific database schema, SQL query,
and any other information that may help us to reproduce the issue you are seeing.