472,780 Members | 1,372 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,780 software developers and data experts.

pgsql optimizer

Hello,
I've got a server postgresql 7.4.6 installed from RPM for linux RH 9.
Lately, I've noticed, that some queries last too long... It appears to me,
that the optimizer does not use index optimizing....
This is what analyze shows:
------
explain analyze update activities set act_synch_date='2005-02-03 00:00:00'
where activities.act_id=17;
QUERY PLAN
----------------------------------------------------------------------------------------------------------------
Seq Scan on activities (cost=0.00..19673.33 rows=2 width=107) (actual
time=1352.235..1352.248 rows=1 loops=1)
Filter: (act_id = 17)
Total runtime: 1354.814 ms
(3 rows)
------
and log for this query:
------
Mar 4 13:05:55 devserver01 postgres[14674]: [4-1] LOG: QUERY STATISTICS
Mar 4 13:05:55 devserver01 postgres[14674]: [4-2] DETAIL: ! system usage
stats:
Mar 4 13:05:55 devserver01 postgres[14674]: [4-3] ^I!^I1.340092 elapsed
0.390000 user 0.170000 system sec
Mar 4 13:05:55 devserver01 postgres[14674]: [4-4] ^I!^I[0.770000 user
0.410000 sys total]
Mar 4 13:05:55 devserver01 postgres[14674]: [4-5] ^I!^I0/0 [0/0]
filesystem blocks in/out
Mar 4 13:05:55 devserver01 postgres[14674]: [4-6] ^I!^I96/3 [8743/182]
page faults/reclaims, 0 [0] swaps
Mar 4 13:05:55 devserver01 postgres[14674]: [4-7] ^I!^I0 [0] signals
rcvd, 0/0 [0/0] messages rcvd/sent
Mar 4 13:05:55 devserver01 postgres[14674]: [4-8] ^I!^I0/0 [0/0]
voluntary/involuntary context switches
Mar 4 13:05:55 devserver01 postgres[14674]: [4-9] ^I! buffer usage stats:
Mar 4 13:05:55 devserver01 postgres[14674]: [4-10] ^I!^IShared blocks:
9659 read, 2 written, buffer hit rate = 0.23%
Mar 4 13:05:55 devserver01 postgres[14674]: [4-11] ^I!^ILocal blocks:
0 read, 0 written, buffer hit rate = 0.00%
Mar 4 13:05:55 devserver01 postgres[14674]: [4-12] ^I!^IDirect blocks:
0 read, 0 written
------
Of course there is index created for act_id.... Why the optimizer does not
use it?
--
Grzegorz Wilk

Jul 19 '05 #1
2 2300
Very interesting.
Never seen that.
Can you show your postgresql.conf?
This is the first thing I would look at.
But everything should be fine in the default configuration.

The other reasons I might suppose are
1) the filter doesn't realy reduce the amount of data. I mean most of the
rows satisfy it. And optimizer decides not to use it.

2) the index needs to be rebuilt (REINDEX ) and the database vacuumed
(VACUUM.... )
"gefek" <th********@spamunieprzyjmuje.wp.pl> wrote in message
news:d0**********@atlantis.news.tpi.pl...
Hello,
I've got a server postgresql 7.4.6 installed from RPM for linux RH 9.
Lately, I've noticed, that some queries last too long... It appears to me,
that the optimizer does not use index optimizing....
This is what analyze shows:
------
explain analyze update activities set act_synch_date='2005-02-03 00:00:00'
where activities.act_id=17;
QUERY PLAN
----------------------------------------------------------------------------------------------------------------
Seq Scan on activities (cost=0.00..19673.33 rows=2 width=107) (actual
time=1352.235..1352.248 rows=1 loops=1)
Filter: (act_id = 17)
Total runtime: 1354.814 ms
(3 rows)
------
and log for this query:
------
Mar 4 13:05:55 devserver01 postgres[14674]: [4-1] LOG: QUERY STATISTICS
Mar 4 13:05:55 devserver01 postgres[14674]: [4-2] DETAIL: ! system usage
stats:
Mar 4 13:05:55 devserver01 postgres[14674]: [4-3] ^I!^I1.340092 elapsed
0.390000 user 0.170000 system sec
Mar 4 13:05:55 devserver01 postgres[14674]: [4-4] ^I!^I[0.770000 user
0.410000 sys total]
Mar 4 13:05:55 devserver01 postgres[14674]: [4-5] ^I!^I0/0 [0/0]
filesystem blocks in/out
Mar 4 13:05:55 devserver01 postgres[14674]: [4-6] ^I!^I96/3 [8743/182]
page faults/reclaims, 0 [0] swaps
Mar 4 13:05:55 devserver01 postgres[14674]: [4-7] ^I!^I0 [0] signals
rcvd, 0/0 [0/0] messages rcvd/sent
Mar 4 13:05:55 devserver01 postgres[14674]: [4-8] ^I!^I0/0 [0/0]
voluntary/involuntary context switches
Mar 4 13:05:55 devserver01 postgres[14674]: [4-9] ^I! buffer usage stats:
Mar 4 13:05:55 devserver01 postgres[14674]: [4-10] ^I!^IShared blocks:
9659 read, 2 written, buffer hit rate = 0.23%
Mar 4 13:05:55 devserver01 postgres[14674]: [4-11] ^I!^ILocal blocks: 0
read, 0 written, buffer hit rate = 0.00%
Mar 4 13:05:55 devserver01 postgres[14674]: [4-12] ^I!^IDirect blocks: 0
read, 0 written
------
Of course there is index created for act_id.... Why the optimizer does not
use it?
--
Grzegorz Wilk


Jul 19 '05 #2
In news:Pk****************@newsread1.news.pas.earthli nk.net Nikolay A
Mirin wrote:
Very interesting.
Never seen that.
Can you show your postgresql.conf?
This is the first thing I would look at.
But everything should be fine in the default configuration.
The other reasons I might suppose are
1) the filter doesn't realy reduce the amount of data. I mean most of
the rows satisfy it. And optimizer decides not to use it.
2) the index needs to be rebuilt (REINDEX ) and the database vacuumed
(VACUUM.... )

I'm sory, but i didn't have time to write... reindex and vacuum helped, it
uses indexes now.
Thanks for help
--
Grzesiek

Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Hema Sekhar | last post by:
Hi I am Hemasekhar K.P I am trying to replicae pgsql on REDHATLinux 8, but the site http://gborg.postgresql.org/genpage?replication_72install. is giving instructions on REDHATLinux 7, is there...
11
by: Daniel E. Fisher | last post by:
> I can't get a rest for a min guys. > > I go away for the weekend and my server is getting this error. > > Fatal error: Call to undefined function: pg_connect() in >...
3
by: Keith Bottner | last post by:
I have been looking for an interactive PL/pgSQL for Postgres with no luck. Does anybody know of one open source or commercial? If not then I would like to know if there is currently a debugging...
4
by: Postgresql | last post by:
Hello, I am unable to get on many of the postgresql mailing lists. I usually get this message back with no attachment and no email comes afterwards with a confirmation. I've tried this over and...
11
by: Ed L. | last post by:
Has anyone successfully built 7.3.4, 7.4.3, or 8.0.0beta1 on IA64 with HP-UX 11i v2 (11.23)? I'm not having any success, running into 'make' failures. Googling old posts suggests this might be...
7
by: snpe | last post by:
Is it down ? regards ---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's...
1
by: John French | last post by:
I just installed postgresql 7.4.5 and pgadmin3 1.0.2 on FreeBSD and noticed that pgadmin allows the pgsql user to log in while ignoring the password. You can enter a wrong password or no password...
1
by: sysxperts | last post by:
Hello, Having an issue that is specific to PHP compiled with PGSQL support with versions noted in subject line. I understand that there are many variables to consider here but believe I have...
0
by: Matt | last post by:
I need an installation with Postgres support, and was happy to find in my phpinfo that there was a --with-pgsql=shared option in the config line. but I still got "call to undefined function:...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.