Ad Widget

Collapse

Oracle and bind variables!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Fry
    Junior Member
    • Sep 2006
    • 12

    #1

    Oracle and bind variables!

    Hello!

    It will be great to implement binded variables using in some cases if we use Oracle as database.
    The list of SQL's where binded variables should be implemented is:

    1 select distinct t.triggerid,t.expression,t.status,t.dep_level,t.pr iority,t.value,t.description from triggers t,functions f,items i where i.status<>3 and i.itemid=f.itemid and t.status=0 and f.triggerid=t.triggerid and f.itemid=18113
    2 select i.itemid,i.key_,h.host,h.port,i.delay,i.descriptio n,i.nextcheck,i.type,i.snmp_community,i.snmp_oid,h .useip,h.ip,i.history,i.lastvalue,i.prevvalue,i.ho stid,h.status,i.value_type,h.errors_from,i.snmp_po rt,i.delta,i.prevorgvalue,i.lastclock,i.units,i.mu ltiplier,i.snmpv3_securityname,i.snmpv3_securityle vel,i.snmpv3_authpassphrase,i.snmpv3_privpassphras e,i.formula,h.available,i.status,i.trapper_hosts,i .logtimefmt,i.valuemapid from hosts h, items i where h.hostid=i.hostid and i.key_='zabbix[log]' and i.value_type=1
    3 select num,value_min,value_avg,value_max from trends where itemid=17940 and clock=1171270800
    4 update functions set lastvalue='499' where itemid=20043 and function='last' and parameter='0'
    5 select distinct function,parameter,itemid,lastvalue from functions where itemid=18700
    6 select 0,lastvalue from functions where functionid=11642
    7 select distinct t.triggerid,t.expression,t.status,t.dep_level,t.pr iority,t.value,t.description from triggers t,functions f,items i where i.status<>3 and i.itemid=f.itemid and t.status=0 and f.triggerid=t.triggerid and f.itemid=25889

    There are some sql's in web-frontend, but their's performance impact is not so great.

    Is it possible to implement this in one of the next releases?
  • Alexei
    Founder, CEO
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Sep 2004
    • 5654

    #2
    While I agree that use of variable bindings is more efficient, I don't think that we will ever use different APIs for different database engines.

    I do believe that minimizing of SQL queries is much more efficient way of improving overall performance and I already have several ideas which would speedup ZABBIX server 2-4x times.
    Alexei Vladishev
    Creator of Zabbix, Product manager
    New York | Tokyo | Riga
    My Twitter

    Comment

    • Fry
      Junior Member
      • Sep 2006
      • 12

      #3
      What do you mean by different APIs?
      You are using libsqlora8 now and you just have to use different fuctions from that library.
      In fact you do use binding variables, e.g. in DBadd_history_text function. You should just do the same in other cases.

      And you don't have to choose only one way to improve the performance - you can implement both =)

      Comment

      • Alexei
        Founder, CEO
        Zabbix Certified Trainer
        Zabbix Certified SpecialistZabbix Certified Professional
        • Sep 2004
        • 5654

        #4
        I mean API to ZABBIX database functions. I do not want to keep different code for different database engines.
        Alexei Vladishev
        Creator of Zabbix, Product manager
        New York | Tokyo | Riga
        My Twitter

        Comment

        • Fry
          Junior Member
          • Sep 2006
          • 12

          #5
          Could you explain me this?

          As i understand you are using different libraries for different DB engine now - e.g. libsqlora8 and libpq. And so you have to implement different code for different db engines. Are you going to change DB drivers?

          Comment

          • Alexei
            Founder, CEO
            Zabbix Certified Trainer
            Zabbix Certified SpecialistZabbix Certified Professional
            • Sep 2004
            • 5654

            #6
            I'm talking about ZABBIX wrapper functions. These functions provide common API (ZABBIX API!) for accessing different database engines (DBselect, DBexecute, DBfetch, etc).

            If we start using bindings, an alternative API has to be introduced and this will lead to alternative high level code for Oracle (think of #ifdef ORACLE every time we work with database). Currently the code is the same for all database engines.
            Alexei Vladishev
            Creator of Zabbix, Product manager
            New York | Tokyo | Riga
            My Twitter

            Comment

            Working...