have an empty template in xml, import it. several weird and potentially redundant queries :
1) SELECT g.groupid,g.name FROM groups g WHERE g.name='Templates'
do we have to select name here ?
2) SELECT g.groupid FROM groups g WHERE g.groupid='13'
eh ?
3)
SELECT h.hostid,h.host FROM hosts h WHERE h.status=3 AND h.host='empty_template'
SELECT h.hostid,h.templateid FROM hosts h WHERE h.status=3 AND h.host='empty_template' LIMIT 1 OFFSET 0
SELECT h.hostid FROM hosts h WHERE h.flags IN (0,4) AND h.status IN (0,1) AND h.host='empty_template' LIMIT 1 OFFSET 0
SELECT h.hostid,h.templateid FROM hosts h WHERE h.status=3 AND h.name='empty_template' LIMIT 1 OFFSET 0
SELECT h.hostid FROM hosts h WHERE h.flags IN (0,4) AND h.status IN (0,1) AND h.name='empty_template' LIMIT 1 OFFSET 0
a) in the first one, we select 'host' even though it's also in the 'where' part
b) sure we can do a smaller amount of selects here...