Hi,

I'm using CakePHP 1.1 for a inventory/invoicing software.

I have 44 tables. The largest ones have ~10,500 and ~26,000 rows.

It's all running on and old Pentium 4 1.8 GHZ with 256MB RAM and
WinXP. The same computer is running MySQL 5.0.37, Apache 2, and PHP 5.

Lately it has been running very slow with these two tables. A view
loading normally takes 9 seconds with the server computer being on a
small wired local network.

I want to get a notable speed boost. What do you recommend me for
accomplishing this?

The tables are:
CREATE TABLE `stock_items` (
  `id` int(11) NOT NULL auto_increment,
  `type` char(1) NOT NULL,
  `stock_id` int(11) NOT NULL,
  `item` int(11) NOT NULL,
  `item_name` varchar(255) default NULL,
  `quantity` int(11) NOT NULL,
  `price` float default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=18640 ;

CREATE TABLE `stock_dispatchs` (
  `id` int(11) NOT NULL auto_increment,
  `datetime` datetime NOT NULL,
  `type` varchar(25) NOT NULL,
  `employee` int(11) default NULL,
  `employee_name` varchar(50) default NULL,
  `invoice` varchar(30) default NULL,
  `branch` int(11) default NULL,
  `job_order_id` int(11) default NULL,
  `repair_order_id` int(11) default NULL,
  `rma_id` int(11) default NULL,
  `customer` int(11) default NULL,
  `customer_name` varchar(55) default NULL,
  `change_open` tinyint(1) NOT NULL default '0',
  `notes` text,
  `deleted` tinyint(1) NOT NULL default '0',
  `delete_reason` text,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=7694 ;



The models are defined as:

class StockItem extends AppModel { // 26,000 rows
        var $name = 'StockItem';
        var $transactional = true;

        var $belongsTo = array(
                                        'Item' => array(
                                                        'className' => 'Item',
                                                        'foreignKey' => 'item'
                                                        ),
                                        'StockDispatch' => array(
                                                        'className' => 
'StockDispatch',
                                                        'foreignKey' => 
'stock_id'
                                                        )
                                        ,
                                        'StockReception' => array(
                                                        'className' => 
'StockReception',
                                                        'foreignKey' => 
'stock_id'
                                                        )
                                        );
}

class StockDispatch extends AppModel { // 10,500 rows

        var $name = 'StockDispatch';
        var $transactional = true;

        var $useTable = "stock_dispatchs";

        var $hasMany = array('StockItem' =>
                         array('className'     => 'StockItem',
                               'conditions'    => "StockItem.type =
'd'",
                               'foreignKey'    => 'stock_id'
                         ),
                                                 'Serial' =>
                                                 array('className' => 'Serial',
                                                                'foreignKey' => 
'stock_dispatch_id'
                                                 )
                  );

        var $belongsTo = array('Employee' =>
                                                  array('className'     => 
'Employee',
                                                                'foreignKey' => 
'employee'
                                                        ),
                                                   'Customer' =>
                                                  array('className'     => 
'Customer',
                                                                'foreignKey' => 
'customer'
                                                        ),
                                                        'JobOrder' =>
                                                  array('className'     => 
'JobOrder',
                                                                'foreignKey' => 
'job_order_id'
                                                        ),
                                                        'RepairOrder' =>
                                                  array('className'     => 
'RepairOrder',
                                                                'foreignKey' => 
'repair_order_id'
                                                        ),
                                                        'Rma' =>
                                                  array('className'     => 
'Rma',
                                                                'foreignKey' => 
'rma_id'
                                                        ),
                                                        'Branch' =>
                                                  array('className'     => 
'Branch',
                                                                'foreignKey' => 
'branch'
                                                        ),
                                                        'SdType' =>
                                                  array('className'     => 
'SdType',
                                                                'foreignKey' => 
'type'
                                                        )
                                        );

        var $validate = array(
      'type' => VALID_NOT_EMPTY
    );
}

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to