[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sqlite-users
Subject:    Re: [sqlite] Sqlite versus mySQL in PHP
From:       "Radu Lodina" <rlodina () gmail ! com>
Date:       2009-03-27 10:13:13
Message-ID: 8772F41E83AB4CAAADDEBDB9927B9CAC () rlodinalaptop
[Download RAW message or body]


One (and first) shoot: - try to use :

BEGIN TRANSACTION

<your insert SQL code>

COMMIT TRANSACTION




----- Original Message ----- 
From: "Anton Rifco" <anton.rifco@gmail.com>
To: <sqlite-users@sqlite.org>
Sent: Friday, March 27, 2009 11:28 AM
Subject: [sqlite] Sqlite versus mySQL in PHP


> Hi guys,
>
> I would like to ask a question about sqlite in php. I don't know if I am
> sending this message to the right place, but I don't know where else to 
> ask.
>
> Lately, I read in http://www.sqlite.org/speed.html, that sqlite is a bit
> faster than mysql and postgreSQL. But, when I perform a little testing yo
> compare them in php, I got a contrast result.
>
> For both testing, I use this table :
> CREATE TABLE test (a varchar(20) PRIMARY KEY, b varchar(20), c 
> varchar(20),
>                          d varchar(20), e varchar(20),  f varchar(20),
>                          g varchar(20), h varchar(20),  i varchar(20), j
> varchar(20))
>
> for that table, I perform 5000 insert for both sqlite and mysql :
> here's for sqlite code :
> =============== sqlite-test.php ===============
> $time_start = microtime(true);
> $db = sqlite_open('pegawai.db', 0666, $sqliteerror);
> for($i = 0; $i < 5000; $i++)
>            {
>                $sql = "INSERT INTO test VALUES
> ('a$i','b$i','c$i','d$i','e$i','b$i','b$i','b$i','b$i','b$i')";
>                $q = sqlite_query($db, $sql);
>            }
> sqlite_close($db);
> $time_end = microtime(true);
> $time = $time_end - $time_start;
> echo "executed in $time seconds\n";
> =========================================
>
> and here's for mysql code :
> ============= mysql-test.php ================
> .............
> $time_start = microtime(true);
> for($i = 0; $i < 5000; $i++)
>        {
>            $sql = "INSERT INTO test VALUES
> ('a$i','b$i','c$i','d$i','e$i','b$i','b$i','b$i','b$i','b$i')";
>            $q = mysql_query($sql);
>        }
> $time_end = microtime(true);
> $time = $time_end - $time_start;
> echo "executed in $time seconds\n";
> ..............
> ===========================================
>
> when I run those 2 script, the first one (sqlite) run for 43.4918169975
> seconds, while the second (mysql) only take 0.52137298584 seconds.
>
> It means that sqlite run 80x longer than mysql did (very contrast with the
> one I read in http://www.sqlite.org/speed.html).
>
> Please tell me where do I did wrong. Thanks very much.
>
> Regards,
>
> ------------------
> Anton Rifco S
>
> Student of Informatics Department
> School of Electrical Engineering and Informatics
> Institute Technology of Bandung
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users 

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic