The Little Guy Posted November 21, 2011 Share Posted November 21, 2011 What would cause this line: insert into searches (domain_id, ip, search_string) values ($domain_id, inet_aton('$ip'), '$string'); To take 0.06 seconds to run? It is only run one time. That takes up half the time it takes my 8 other queries to run (inserts and selects). Link to comment https://forums.phpfreaks.com/topic/251520-slow-insert/ Share on other sites More sharing options...
Alexv Posted November 21, 2011 Share Posted November 21, 2011 How does the table look like and how many records does it have? Link to comment https://forums.phpfreaks.com/topic/251520-slow-insert/#findComment-1289946 Share on other sites More sharing options...
fenway Posted November 21, 2011 Share Posted November 21, 2011 Other than too many indexes, there's little you can do. Link to comment https://forums.phpfreaks.com/topic/251520-slow-insert/#findComment-1290013 Share on other sites More sharing options...
The Little Guy Posted November 21, 2011 Author Share Posted November 21, 2011 I have 2 indexes on the table and ~130 row in it. +---------------+------------------+------+-----+-------------------+----------------+ | Field | Type | Null | Key | Default | Extra | +---------------+------------------+------+-----+-------------------+----------------+ | search_id | int(10) unsigned | NO | PRI | NULL | auto_increment | | domain_id | int(10) unsigned | NO | MUL | NULL | | | ip | int(10) unsigned | YES | | NULL | | | search_string | char(50) | NO | | NULL | | | search_date | timestamp | NO | | CURRENT_TIMESTAMP | | +---------------+------------------+------+-----+-------------------+----------------+ +----------+------------+-----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+ | Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment | +----------+------------+-----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+ | searches | 0 | PRIMARY | 1 | search_id | A | 134 | NULL | NULL | | BTREE | | | | searches | 1 | domain_id | 1 | domain_id | A | 2 | NULL | NULL | | BTREE | | | +----------+------------+-----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+ Link to comment https://forums.phpfreaks.com/topic/251520-slow-insert/#findComment-1290029 Share on other sites More sharing options...
fenway Posted November 21, 2011 Share Posted November 21, 2011 Then that's how long it takes -- you're not exactly benchmarking here. Link to comment https://forums.phpfreaks.com/topic/251520-slow-insert/#findComment-1290030 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.