Question on multiple queries

16 views
Skip to first unread message

Gerald Guido

unread,
Jul 15, 2011, 11:59:42 AM7/15/11
to dat...@googlegroups.com
Steve,

I am working on a new project and I noticed that for every call to getRecords I get three queries, two for metadata and one for the actual query. I am using DataMgr_MYSQL to create the object. It is pretty standard stuff and I am really not doing anything out of the ordinary other than I have a bunch of indexes on the tables for my one to many and many to many relationships. I have been using DataMGR for years and this is the first time I have seen this. Or maybe I just never noticed.

Any idea why this is happening? And is there i can do to avoid these additional queries from happening?

I am using
V 2.2.0.3 (Build 152) 
CF9.0.1
MySQL 5.5.13

As always, many TIA,
G!

This is what I am getting for each call.

SQL Queries qQuery (Datasource=snippet_farm, Time=3ms, Records=1) in C:\UniServer_7_1_1\www\_Snippet_Farm\_admin\cfc\DataMgrEngine_cf8.cfc @ 11:30:35.035
SHOW TABLES LIKE 'snippets'
qQuery (Datasource=snippet_farm, Time=12ms, Records=16) in C:\UniServer_7_1_1\www\_Snippet_Farm\_admin\cfc\DataMgrEngine_cf8.cfc @ 11:30:35.035
SHOW COLUMNS FROM snippets
qQuery (Datasource=snippet_farm, Time=2ms, Records=1) in C:\UniServer_7_1_1\www\_Snippet_Farm\_admin\cfc\DataMgrEngine_cf8.cfc @ 11:30:35.035
SELECT `snippets`.`snippets_id` , `snippets`.`users_user_ID` , `snippets`.`languages_language_ID` , `snippets`.`languages_language2_ID` , `snippets`.`txt_snip_title` , `snippets`.`txt_snip_description` , `snippets`.`txt_snip_raw_code` , `snippets`.`txt_snip_colorized_code` , `snippets`.`txt_PasteBinID` , `snippets`.`txt_PasteBin_Subdomain` , `snippets`.`txt_Author_Email` , `snippets`.`date_posted` , `snippets`.`parent_snippets_id` , `snippets`.`ip_address` , `snippets`.`bit_private` , `snippets`.`languages_language_ID1` FROM		`snippets` WHERE		1 = 1 AND		`snippets`.`snippets_id` = ? 
Query Parameter Value(s) -
Parameter #1(CF_SQL_INTEGER) = 3



--
Gerald Guido
http://www.myinternetisbroken.com
 
"ONE  TWO  THREE  FOUR!!!"
-- Dee Dee Ramone

Steve Bryant

unread,
Jul 15, 2011, 3:46:04 PM7/15/11
to dat...@googlegroups.com
Gerald,

The first two queries are going to execute the first time a given
instance of DataMgr touches a specific table. That means that if you
are instantiating DataMgr fresh every time that you use it then you
are going to see this overhead.

I generally instantiate DataMgr into the broadest and longest living
scope that I can for a given problem. That usually means that I have
DataMgr instantiated into Application scope.

If you have it in Application scope then those two queries will run
the first time that it touches a table, but not again after that.

Let me know how that works out for you.

Thanks,

Steve

Gerald Guido

unread,
Jul 15, 2011, 4:04:04 PM7/15/11
to dat...@googlegroups.com
You know what? That is exactly it.  Normally I cache (most) all my CFCs. But I was creating a new object on every page load cuz the tables were changing so much and I always seem to forget to reload DataMGR. My bad.

Great stuff BTW. DataMGR is one of my favorite dev tools. A staple of my tool kit. Thanx for sharing it.

Thanx,
G!
 

--
You received this message because you are subscribed to the Google Groups "DataMgr" group.
To post to this group, send email to dat...@googlegroups.com.
To unsubscribe from this group, send email to datamgr+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/datamgr?hl=en.

Steve Bryant

unread,
Jul 15, 2011, 9:10:37 PM7/15/11
to dat...@googlegroups.com
Gerald,

Glad that worked for you!

Thanks for the kind words as well, I really appreciate that.

Steve

Reply all
Reply to author
Forward
0 new messages