#1 2016-03-22 20:36:22

hnb
Member
Registered: 2015-06-15
Posts: 290

Big SELECT before DELETE?

Hi AB,

I have following Delete:

GIID_Server.Delete(TSQLiid, '(creation_time_server < ?) or (creation_time_server is null)', [DateTimeToSQL(IncDay(Now, -2))])

for Delete command is executed SELECT (before Delete) with very long result... Is this by ORM design? Maybe is good idea to add "LIMIT 1"?

20160322 14262560  " DB    	mORMotSQLite3.TSQLRestServerDB(017AF1E0) prepared 89us iid.db3 SELECT RowID FROM iid WHERE (creation_time_server < ?) or (creation_time_server is null)
20160322 14262600  " SQL   	mORMotSQLite3.TSQLRestServerDB(017AF1E0) 25.07ms returned 18785 rows as 233101 bytes SELECT RowID FROM iid WHERE (creation_time_server < :('￱2016-03-20T15:26:25'):) or (creation_time_server is null)
20160322 14262600  " res   	SynSQLite3.TSQLDatabase(01D392F0) [{"ID":1},{"ID":2},{"ID":3},{"ID":4},{"ID":5},{"ID":6},{"ID":7},{"ID":8},{"ID":9},{"ID":10},{"ID":11},{"ID":12},{"ID":13},{"ID":14},{"ID":15},{"ID":16},{"ID":17},{"ID":18},{"ID":19},{"ID":20},{"ID":21},{"ID":22},{"ID":23},{"ID":24},{"ID":25},{"ID":26},{"ID":27},{"ID":28},{"ID":29},{"ID":30},{"ID":31},{"ID":32},{"ID":33},{"ID":34},{"ID":35},{"ID":36},{"ID":37},{"ID":38},{"ID":39},{"ID":40},{"ID":41},{"ID":42},{"ID":43},{"ID":44},{"ID":45},{"ID":46},{"ID":47},{"ID":48},{"ID":49},{"ID":50},{"ID":51},{"ID":52},... (truncated) length=233101
20160322 14262600  " cache 	SynSQLite3.TSQLDatabase(01D392F0) iid.db3 cache flushed
20160322 14262600  " DB    	mORMotSQLite3.TSQLRestServerDB(017AF1E0) prepared 77us iid.db3 DELETE FROM iid WHERE (creation_time_server < ?) or (creation_time_server is null)
20160322 14262637  " SQL   	mORMotSQLite3.TSQLRestServerDB(017AF1E0) 586.54ms  DELETE FROM iid WHERE (creation_time_server < :('￱2016-03-20T15:26:25'):) or (creation_time_server is null)

Last edited by hnb (2016-03-22 20:37:13)


best regards,
Maciej Izak

Offline

#2 2016-03-23 07:01:26

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,666
Website

Re: Big SELECT before DELETE?

The IDs are retrieved before the deletion, to notify internal triggers.

What do you mean "very long"?
The timing are not huge: 25.07ms, 586.54 ms....

Offline

#3 2016-03-23 07:46:16

hnb
Member
Registered: 2015-06-15
Posts: 290

Re: Big SELECT before DELETE?

I mean length of indirect result string (233101), for simple "Delete". Anyway if this is by design I have no problem with that.


best regards,
Maciej Izak

Offline

Board footer

Powered by FluxBB