PHP Postgres query slower then PgAdmin

From: Emrah Mehmedov <emrah(dot)mehmedov(at)x3mlabs(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: PHP Postgres query slower then PgAdmin
Date: 2013-06-05 10:18:09
Message-ID: CAGRV00KDQ9_f0S+FKq2B2-ACCYp8tuibwdAASgbWd1O6a5D9ww@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hello,

I'm using php5.4.12 with extension=php_pgsql.dll enabled but the query that
i'm trying to execute is faster on PgAdmin app.

SELECT title, ts_rank_cd(vector, query) AS rank FROM links,
to_tsquery('english', 'risk') query WHERE query @@ vector ORDER BY rank
DESC;

I'm not sure, what can i do to increase the speed of execution from php:

$start_time = microtime(true);
$query = "SELECT title, url, ts_rank_cd(vector, query) AS rank FROM links,
to_tsquery('english', 'risk') query WHERE query @@ vector ORDER BY rank
DESC LIMIT 10;";
$result = pg_query($connection, $query);
$end_time = microtime(true);

persistant connections are enabled in php.ini but i calculate only
execution time from start to end.

Thanks, Emrah.

--
Best regards, Emrah Mehmedov
Software Developer @ X3M Labs
http://www.extreme-labs.com

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Bob Jolliffe 2013-06-05 11:01:39 Re: PHP Postgres query slower then PgAdmin
Previous Message Jeff Janes 2013-06-03 16:49:36 Re: Advice on optimizing select/index