Thread: Slow first query

Slow first query

From
Rob Brenart
Date:
I'm running postgresql 8.0 under WindowsXP for a development box (the
production server isn't up yet, and will be linux, so I don't know that
the problem will travel)...

Using a PHP connection to it for a simple web app, if I leave the app
alone for a bit (about 20 seconds I'd say) and do something that
requires a query the next page load is slow, not 20 seconds slow, but
3-5 seconds.... but as long as I stay active the page reloads are
instantaneous.

Is there anything I can do about this, or should I just wait to see how
it performs on my production server before I worry too much?


Re: Slow first query

From
Richard Huxton
Date:
Rob Brenart wrote:
> I'm running postgresql 8.0 under WindowsXP for a development box (the
> production server isn't up yet, and will be linux, so I don't know that
> the problem will travel)...
>
> Using a PHP connection to it for a simple web app, if I leave the app
> alone for a bit (about 20 seconds I'd say) and do something that
> requires a query the next page load is slow, not 20 seconds slow, but
> 3-5 seconds.... but as long as I stay active the page reloads are
> instantaneous.
>
> Is there anything I can do about this, or should I just wait to see how
> it performs on my production server before I worry too much?

Since you don't say what's causing it, difficult to say what the problem
is. Might it just be caching, does your development box have a lot of
memory free to cache disk blocks?

Otherwise, it could be almost anything. You'll have to run some
timing/traces on the various elements of your setup (php/webserver/pg).

--
   Richard Huxton
   Archonet Ltd

Re: Slow first query

From
Rob Brenart
Date:
Richard Huxton wrote:

> Rob Brenart wrote:
>
>> I'm running postgresql 8.0 under WindowsXP for a development box (the
>> production server isn't up yet, and will be linux, so I don't know
>> that the problem will travel)...
>>
>> Using a PHP connection to it for a simple web app, if I leave the app
>> alone for a bit (about 20 seconds I'd say) and do something that
>> requires a query the next page load is slow, not 20 seconds slow, but
>> 3-5 seconds.... but as long as I stay active the page reloads are
>> instantaneous.
>>
>> Is there anything I can do about this, or should I just wait to see
>> how it performs on my production server before I worry too much?
>
>
> Since you don't say what's causing it, difficult to say what the
> problem is. Might it just be caching, does your development box have a
> lot of memory free to cache disk blocks?
>
> Otherwise, it could be almost anything. You'll have to run some
> timing/traces on the various elements of your setup (php/webserver/pg).
>
Yeah, I didn't say what's causing it because as of yet I haven't had
time to do any serious analysis on it... I thought I'd throw it out
there and see if anyone else had experience with it first.

My guess is it's exactly what you're saying, some component or another
is getting tossed from RAM to disk and slowing things down.

Re: Slow first query

From
Scott Marlowe
Date:
On Tue, 2005-07-19 at 16:31, Rob Brenart wrote:
> Richard Huxton wrote:
>
> > Rob Brenart wrote:
> >
> >> I'm running postgresql 8.0 under WindowsXP for a development box (the
> >> production server isn't up yet, and will be linux, so I don't know
> >> that the problem will travel)...
> >>
> >> Using a PHP connection to it for a simple web app, if I leave the app
> >> alone for a bit (about 20 seconds I'd say) and do something that
> >> requires a query the next page load is slow, not 20 seconds slow, but
> >> 3-5 seconds.... but as long as I stay active the page reloads are
> >> instantaneous.
> >>
> >> Is there anything I can do about this, or should I just wait to see
> >> how it performs on my production server before I worry too much?
> >
> >
> > Since you don't say what's causing it, difficult to say what the
> > problem is. Might it just be caching, does your development box have a
> > lot of memory free to cache disk blocks?
> >
> > Otherwise, it could be almost anything. You'll have to run some
> > timing/traces on the various elements of your setup (php/webserver/pg).
> >
> Yeah, I didn't say what's causing it because as of yet I haven't had
> time to do any serious analysis on it... I thought I'd throw it out
> there and see if anyone else had experience with it first.
>
> My guess is it's exactly what you're saying, some component or another
> is getting tossed from RAM to disk and slowing things down.

Also note that there are settings in Windows workstation that favor
higher performance for the interactive graphical environment over the
performance of server type processes.  So, if you've got a lot of memory
being used by your GUI and desktop apps, this is completely normal
behaviour in the workstation version of Windows, and the fix is to
deploy to a server version.