<div dir="ltr"><p>Hello.<br></p><p>I've wrote simple benchmark, in order to test ODBC and pgsql drivers. I got very strange results, saying that ODBC 160 times slower than pgsql:<br>
</p>
<p>[pgsql_bm] runtime = 50, wall_clock = 144<br>
</p>
<p>[odbc_bm] runtime = 0, wall_clock = 8009</p><p>There might be my mistake in odbc.ini/odbcinst.ini or smth else, so I'm writting this letter. Is it normal that ODBC works too slow?<br>
</p>
<p>The code used:<br></p><p>------------------------------------<br></p><p>odbc_bm() -><br> odbc:start(),<br> {ok, Ref} = odbc:connect("DSN=PostgreSQL", []),<br> benchmark("odbc_bm",<br> fun() -> odbc:sql_query(Ref, "INSERT INTO foo (bar) VALUES (123)") end,<br>
200),<br> odbc:stop().<br><br>pgsql_bm() -><br> {ok, Db} = pgsql:connect("localhost", "gin", "gin", ""),<br> benchmark("pgsql_bm",<br> fun() -> pgsql:squery(Db, "INSERT INTO foo (bar) VALUES (123)") end,<br>
200),<br> pgsql:terminate(Db).</p><p>benchmark(Title, Fun, Times) -><br> statistics(runtime),<br> statistics(wall_clock),<br> for(1, Times, Fun),<br> {_, Runtime} = statistics(runtime),<br>
{_, Wallclock} = statistics(wall_clock),<br></p><p>for(I, Max, _) when I > Max -><br> ok;<br>for(I, Max, F) -><br> F(),<br> for(I+1, Max, F).<br><br></p><p>------------------------------------</p><p>
Additional information:<br></p>I use pgsql from ejabberd-modules package, erlang R12B.3, PostgreSQL 8.3.3, unixodbc 2.2.12, psqlodbc 08.03.0200<br>OS: Archlinux current<br><p>odbc.ini:<br></p><p>[PostgreSQL]<br>Description = foobar<br>
Driver = PostgreSQL<br>Database = gin<br>Servername = localhost<br>UserName = sergey<br>Password =<br><br>odbcinst.ini:</p><p>[PostgreSQL]<br>Description = PostgreSQL driver<br>Driver = /usr/lib/psqlodbcw.so<br>
Setup = /usr/lib/libodbcpsqlS.so<br><br></p><p></p><p>--</p><p>Sergey</p></div>