Using PostgreSQL on my computer, your code executes in 3.5 seconds with GHCi, while compiled it executes in 16.2 seconds! Clearly something is wrong, although I don't yet know enough about Takusen enough to be able to say what.
I tried hoisting the preparation of the statement out of the loop, however, Takusen throws an error after the first insertion. However, the insertion was apparently successful, as a single row shows up in the table afterwards. Here's sample code and a sample shell session: Best, Leon > import Database.PostgreSQL.Enumerator > import Database.Enumerator > import Control.Monad(forM_) > main = do > withSession > (connect [ CAhost "localhost" > , CAport "5432" > , CAuser "takusen" > , CApassword "takusen" > , CAdbname "test" ]) > $ do > execDDL (sql "create table x (y text)") > let query = sql "insert into x (y) values (?)" > stmt = prepareQuery "testinsert" query [bindType (0::Int)] > forM_ ([1..10000] :: [Int]) $ \x -> do > withPreparedStatement stmt $ \pstmt -> do > withBoundStatement pstmt [bindP x] $ \bstmt -> do > execDML bstmt > return () $ psql test psql (8.4.2) Type "help" for help. test=# select * from x; ERROR: relation "x" does not exist LINE 1: select * from x; ^ test=# \q $ ghci Tak.lhs GHCi, version 6.12.1: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Loading package ffi-1.0 ... linking ... done. [1 of 1] Compiling Main ( Tak.lhs, interpreted ) Ok, modules loaded: Main. (0.09 secs, 40984568 bytes) *Main> main Loading package mtl-1.1.0.2 ... linking ... done. Loading package old-locale-1.0.0.2 ... linking ... done. Loading package old-time-1.0.0.3 ... linking ... done. Loading package time-1.1.4 ... linking ... done. Loading package Takusen-0.8.5 ... linking ... done. *** Exception: DBError ("","") 1 "" *Main> :q Leaving GHCi. $ psql test psql (8.4.2) Type "help" for help. test=# select * from x; y --- 1 (1 row) _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe