Since Reactor only runs this query one time, at app startup, when in
production mode, I don't really see what difference this will make. In
development mode it reruns this on every request so I could see that, but
honestly unless you're changing tables really often you probably would be
fine running Reactor in production mode even when you're just doing local
development.

On 5/4/07, Bryan S <[EMAIL PROTECTED]> wrote:

My new Model Glue app is painfully slow so I did some detective work to
find out what is causing the problem. I determined at least part of the
problem is due to a query in reactor. I'll post the enhancement at the
bottom of this message. There may be drawbacks to my change so someone
should look it over before I submit a Trac ticket.

I created a default Model Glue application based on the
modelglueapplication template. All it has added to It is one scaffold for a
table that has an auto increment primary key field and one other text field.


Using a stop watch I timed list, insert, and update events. (the hundreds
of seconds could be off due to my button pushing on my stop watch)

I did this for the basic app on my local machine.
I did this for the same table inside my full application on my local
machine.
I did this for the same table inside my full application on our
development UNIX server.
The full application has a pretty big reactor.xml with a lot of one to
many and many to many relationships defined.

I hope this comes out formatted so everyone can read it easily. If not let
me know and I'll try again.

   time in seconds Local Basic App Local Full App UNIX Full App



 Before ObjectDao Change


 init 1.1 4.96 20.18  list           1.05 1.26 4.59  edit (time for form
to come up)         45.7 45.46 27.03  save (time for list to come back)
            43.08 44.24 27.73  edit (again)            1.09 1.02 4.44  save
(again)            42.61 44.61 26.54  edit (third time) 0.75 1.12 4.37  save
(third time) 42.93 44.44 26.72



 After ObjectDao Change


 init 1.58 5.1 19.78  list           1.11 1.28 4.15  edit (time for form
to come up)         14.95 14.81 11.71  save (time for list to come back)
            12.01 13.77 11.72  edit (again)            0.94 1.1 4.58  save
(again)            11.78 13.19 11.44  edit (third time) 0.85 1.19 4.61  save
(third time) 11.65 13.51 12.06

Here is the change I made to reactor\data\oracle\ObjectDao.cfc
cffunction name="readFields"
LOOK FOR THE ALL CAPS COMMENTS

        <cfquery name="qFields"  datasource="#getDsn()#"
username="#getUsername()#" password="#getPassword()#">
             SELECT
                       col.COLUMN_NAME       as name,
                    CASE
                          WHEN primaryConstraints.column_name IS NULL THEN
'false'
                          ELSE 'true'
                    END                   as primaryKey,
                    /* Oracle has no equivalent to autoincrement or
identity */
                    'false'                     AS
"IDENTITY",
                    CASE
                          WHEN col.NULLABLE = 'Y' THEN 'true'
                          ELSE 'false'
                    END                  as NULLABLE,
                   col.DATA_TYPE         as dbDataType,
                    case
                      /* 26 is the length of now() in ColdFusion (i.e. {ts
'2006-06-26 13:10:14'})*/
                      when col.data_type = 'DATE'   then 26
                      /* Oracle can compress a number in a smaller field
so use precision if available */
                      else nvl(col.data_precision, col.data_length)
                    end                   as length,
                    col.data_scale        as scale,
                    col.DATA_DEFAULT      as "DEFAULT",
                    CASE
                          WHEN updateCol.updatable = 'YES' THEN 'false'
                          ELSE 'true'
                    END                  as readonly
              FROM  all_tab_columns   col,
                     all_updatable_columns updateCol,
                    ( select  colCon.column_name,
                                 colcon.table_name
                    from   all_cons_columns  colCon,
                           all_constraints   tabCon
                    where tabCon.table_name = <cfqueryparam
cfsqltype="cf_sql_varchar" maxlength="128"
value="#arguments.Object.getName()#" />
                         AND colCon.CONSTRAINT_NAME =
tabCon.CONSTRAINT_NAME

                         <!--- ORIGINAL CODE
                         AND colCon.TABLE_NAME      = tabCon.TABLE_NAME
                          --->
                         <!--- ENHANCED CODE --->
                         AND colCon.TABLE_NAME      = <cfqueryparam
cfsqltype="cf_sql_varchar" maxlength="128"
value="#arguments.Object.getName()#" />


                         AND 'P'                    =
tabCon.CONSTRAINT_TYPE
                   ) primaryConstraints
              where col.table_name = <cfqueryparam
cfsqltype="cf_sql_varchar" maxlength="128"
value="#arguments.Object.getName()#" />
                      and col.COLUMN_NAME        =
primaryConstraints.COLUMN_NAME (+)
                    AND col.TABLE_NAME       =
primaryConstraints.TABLE_NAME (+)

                    <!--- ORIGINAL CODE
                    and updateCol.table_name  (+) = col.table_name
                    and updateCol.COLUMN_NAME (+) = col.COLUMN_NAME
                     --->
                    <!--- ENHANCED CODE --->
                    and updateCol.table_name   = <cfqueryparam
cfsqltype="cf_sql_varchar" maxlength="128"
value="#arguments.Object.getName()#" />
                    and updateCol.COLUMN_NAME  = col.COLUMN_NAME


          order by col.column_id
        </cfquery>






-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- --
Reactor for ColdFusion Mailing List
[EMAIL PROTECTED]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- --


-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Reactor for ColdFusion Mailing List
[EMAIL PROTECTED]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Reply via email to