pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joel Fradkin <jfradkin@wazagua.com>
To: gsstark@mit.edu
Cc: 'Richard Huxton' <dev@archonet.com>
Cc: pgsql-sql@postgresql.org
Cc: ac@wazagua.com
Cc: 'Steve Goldsmith' <SGoldsmith@fcci-group.com>
Subject: Re: same question little different test MSSQL vrs Postgres
Date: Wed, 26 Jan 2005 12:04:07 -0500
Message-ID: <000001c503c9$0d2e38d0$797ba8c0@jfradkin> (raw)
In-Reply-To: <87r7k8yw1t.fsf@stark.xeocode.com>

Thank you I will look at that info.
I did do an EXPLAIN ANALYSE on the view and could see it was doing the seq
scan on 3 fields, so I did an index for the three fields and it then chose
an index scan and ran in 27 seconds.

I also did adjust my defaults to much smaller numbers on shared buffers (per
the tidbits page recommendation like 8 meg for my memory size). I looked at
http://www.desknow.com/kb/idx/0/061/article/ which recommended doing a
vacuum verbose to determine the exact max_fsm_pages and I set the cache to
use 25% of my available memory per the recommendation on tid bits.

Joel Fradkin
 
Wazagua, Inc.
2520 Trailmate Dr
Sarasota, Florida 34243
Tel.  941-753-7111 ext 305
 
jfradkin@wazagua.com
www.wazagua.com
Powered by Wazagua
Providing you with the latest Web-based technology & advanced tools.
C 2004. WAZAGUA, Inc. All rights reserved. WAZAGUA, Inc
 This email message is for the use of the intended recipient(s) and may
contain confidential and privileged information.  Any unauthorized review,
use, disclosure or distribution is prohibited.  If you are not the intended
recipient, please contact the sender by reply email and delete and destroy
all copies of the original message, including attachments.
 

 

-----Original Message-----
From: gsstark@mit.edu [mailto:gsstark@mit.edu] 
Sent: Wednesday, January 26, 2005 11:50 AM
To: Joel Fradkin
Cc: 'Richard Huxton'; gsstark@mit.edu; pgsql-sql@postgresql.org;
ac@wazagua.com; Steve Goldsmith
Subject: Re: [SQL] same question little different test MSSQL vrs Postgres

"Joel Fradkin" <jfradkin@wazagua.com> writes:

> I tried the SET ENABLE_SEQSCAN=FALSE;
> And the result took 29 secs instead of 117.
> 
> After playing around with the cache and buffers etc I see I am no longer
> doing any swapping (not sure how I got the 100 sec response might have
been
> shared buffers set higher, been goofing around with it all morning).

If it's swapping you're definitely going to get bad results. You really want
the *majority* of RAM left free for the OS to cache disk data.

> My worry here is it should obviously use an index scan so something is not
> setup correctly yet. I don't want to second guess the analyzer (or is this
a
> normal thing?)

No that's not obvious. 22k out of 344k is a selectivity of 6.6% which is
probably about borderline. The optimizer is estimating even worse at 10.9%
which isn't far off but puts it well out of the range for an index scan.

If you really want to get postgres using an index scan you'll have to a)
improve the estimate using "alter table tblcase alter column clientnum set
statistics" to raise the statistics target for that column and reanalyze. 

And b) lower random_page_cost. random_page_cost tells postgres how much
slower
indexes are than table scans and at the default setting it accurately
represents most disk hardware. If your database fits within RAM and is often
cached then you might have to lower it to model that fact. But you shouldn't
do it based on a single query like this.


-- 
greg




view thread (19+ messages)  latest in thread

Message-ID: <000001c503c9$0d2e38d0$797ba8c0@jfradkin>
Permalink:  ../000001c503c9$0d2e38d0$797ba8c0@jfradkin/
Also on:    postgresql.org/message-id/000001c503c9$0d2e38d0$797ba8c0@jfradkin

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: jfradkin@wazagua.com, gsstark@mit.edu, dev@archonet.com, ac@wazagua.com, SGoldsmith@fcci-group.com
  Subject: Re: same question little different test MSSQL vrs Postgres
  In-Reply-To: <000001c503c9$0d2e38d0$797ba8c0@jfradkin>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox