On Tuesday, July 24, 2012 10:39:59 AM UTC-7, Matt Hauck wrote:
>
> I'm continuing to look into performance improvements w/ Derby, and have 
> noticed that a large portion of time (11%) is spent in 
> EmbedStatement.executeQuery. I found this strange, in that I have turned on 
> the prepared statements (safe) plugin globally for all models. The only 
> place I could see executeQuery being called for derby is in last_insert_id. 
> But especially with tests I'm running, I'm not doing that many inserts, so 
> I couldn't figure out why it was calling it so much.
>
>
executeQuery is used for all statements that return rows (whether they are 
prepared or not), see lib/sequel/adapters/jdbc.rb
 

> Looking in the logs, it looks like last_insert_id is being called when 
> there is no insert happening:
>
> [2012-07-24 17:28:33] DEBUG [MDM] - (0.001000s) SELECT * FROM "COMMANDS" 
> WHERE (("COMMANDS"."DEVICE_ID" = 50       ) AND ("DELIVERED_AT" IS NULL)) 
> ORDER BY "CREATED_AT" ASC FETCH FIRST 1 ROWS ONLY
> [2012-07-24 17:28:33] DEBUG [MDM] - (0.000000s) SELECT 
> IDENTITY_VAL_LOCAL() FROM sysibm.sysdummy1
> [2012-07-24 17:28:33] DEBUG [MDM] - (0.000000s) EXECUTE smpsp_3 (SELECT * 
> FROM "COMMANDS" WHERE ("ID" = ?) F       ETCH FIRST 1 ROWS ONLY); [7598]
>
> As I write this, I realize the large number of executeQuery calls is 
> probably related to the prepared statements which are EXECUTE statements, 
> probably via executeQuery. Is that correct? Even still, can you explain 
> this IDENTITY_VAL_LOCAL() call in this context?
>

I can't think of a reason for the IDENTITY_VAL_LOCAL() call in that 
context, it should only be called for inserts.  Can you post a self 
contained example showing the problem?

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sequel-talk/-/ri6BYpJWhhoJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to