Ad Widget

Collapse

query taking loner

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kaushikrsharma
    Junior Member
    • Feb 2016
    • 1

    #1

    query taking loner

    Below query is taking longer around 400 seconds. can some one please what should we do to improve performance.
    select clock,ns,value from history where itemid=1958264 and clock<=145544224 and clock>145540224 order by clock desc limit 1

    mysql> show create table history \G
    *************************** 1. row ***************************
    Table: history
    Create Table: CREATE TABLE `history` (
    `itemid` bigint(20) unsigned NOT NULL,
    `clock` int(11) NOT NULL,
    `value` double(16,4) NOT NULL,
    `ns` int(11) NOT NULL,
    KEY `history_1` (`itemid`,`clock`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1
    /*!50100 PARTITION BY RANGE ( clock)
    (PARTITION p2016_02_08 VALUES LESS THAN (1454976000) ENGINE = InnoDB,
    PARTITION p2016_02_09 VALUES LESS THAN (1455062400) ENGINE = InnoDB,
    PARTITION p2016_02_11 VALUES LESS THAN (1455235200) ENGINE = InnoDB,
    PARTITION p2016_02_12 VALUES LESS THAN (1455321600) ENGINE = InnoDB,
    PARTITION p2016_02_13 VALUES LESS THAN (1455408000) ENGINE = InnoDB,
    PARTITION p2016_02_14 VALUES LESS THAN (1455494400) ENGINE = InnoDB) */
  • Colttt
    Senior Member
    Zabbix Certified Specialist
    • Mar 2009
    • 878

    #2
    it would be nice if you're using code-blocks..

    we need more information.. how big is you database/partition? RAM, CPU, etc.. is the zabbix server and the database on the same server?
    Debian-User

    Sorry for my bad english

    Comment

    Working...