Speeding up query

From: "Andrus" <kobruleht2(at)hot(dot)ee>
To: pgsql-general(at)postgresql(dot)org
Subject: Speeding up query
Date: 2008-11-05 17:51:24
Message-ID: gesmf0$2ost$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have Server running on Windows XP using
PostgreSQL 8.1.4 on i686-pc-mingw32, compiled by GCC gcc.exe (GCC) 3.4.2
(mingw-special)
Db size is 862 MB
8 users

Bigger tables:

1 1214 pg_shdepend 775 MB
2 1232 pg_shdepend_depender_index 285 MB
3 19701 rid 234 MB
4 19301 bilkaib 170 MB
5 1233 pg_shdepend_reference_index 156 MB
6 19335 dok 146 MB

Sometimes simple query

explain SELECT dokumnr
FROM DOK
where dokumnr IN (110774)
AND (
dokumnr IN (SELECT dokumnr FROM bilkaib WHERE
alusdok='LY' AND masin LIKE 'a%') )

"Nested Loop IN Join (cost=0.00..8.51 rows=1 width=4)"
" -> Index Scan using dok_dokumnr_idx on dok (cost=0.00..4.81 rows=1
width=4)"
" Index Cond: (dokumnr = 110774)"
" -> Index Scan using bilkaib_dokumnr_idx on bilkaib (cost=0.00..44.26
rows=12 width=4)"
" Index Cond: (dokumnr = 110774)"
" Filter: ((alusdok = 'LY'::bpchar) AND (masin ~~ 'a%'::text))"

takes 34 seconds. Tables are indexed and logfile shows autovacuum running.
I ran VACUUM ANALYZE.
It returns

INFO: free space map contains 22501 pages in 77 relations
DETAIL: A total of 20000 page slots are in use (including overhead).
111216 page slots are required to track all free space.
Current limits are: 20000 page slots, 1000 relations, using 186 KB.
NOTICE: number of page slots needed (111216) exceeds max_fsm_pages (20000)
HINT: Consider increasing the configuration parameter "max_fsm_pages" to a
value over 111216.
Query returned successfully with no result in 201099 ms.

How to speed up this query ?

Should I set max_fsm_pages to a 113000 or other suggestions ?

Andrus.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Laurent Wandrebeck 2008-11-05 17:59:01 Re: storing passwords
Previous Message Brandon Metcalf 2008-11-05 17:49:20 storing passwords