Re: PHP Postgres query slower then PgAdmin

From: Bob Jolliffe <bobjolliffe(at)gmail(dot)com>
To: Emrah Mehmedov <emrah(dot)mehmedov(at)x3mlabs(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: PHP Postgres query slower then PgAdmin
Date: 2013-06-05 11:11:49
Message-ID: CACd=f9f+s1ho30JowRa--6438BbhYBXpB7adoW_smOcG2Q3_xA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Most probably. If your existing connection string specifies something like
"host=localhost port=5432 ..." just remove the host and port parameters and
php will by default try to connect with unix domain socket.

On 5 June 2013 12:02, Emrah Mehmedov <emrah(dot)mehmedov(at)x3mlabs(dot)com> wrote:

> Can we modify php connection?
>
>
> On Wed, Jun 5, 2013 at 1:01 PM, Bob Jolliffe <bobjolliffe(at)gmail(dot)com>wrote:
>
>> Is php connecting through tcp whilst pgadmin is using unix domain socket?
>> Probably the query time is the same, but returning the result over tcp
>> will be slower.
>>
>>
>> On 5 June 2013 11:18, Emrah Mehmedov <emrah(dot)mehmedov(at)x3mlabs(dot)com> wrote:
>>
>>> 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
>>>
>>
>>
>
>
> --
> Best regards, Emrah Mehmedov
> Software Developer @ X3M Labs
> http://www.extreme-labs.com
>

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Emrah Mehmedov 2013-06-05 11:15:43 Re: PHP Postgres query slower then PgAdmin
Previous Message Emrah Mehmedov 2013-06-05 11:02:31 Re: PHP Postgres query slower then PgAdmin