pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kevin Grittner <Kevin.Grittner@wicourts.gov>
To: David Greco <David_Greco@harte-hanks.com>
To: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Re: Real vs Int performance
Date: Wed, 26 Jan 2011 15:52:51 -0600
Message-ID: <4D4043530200002500039D99@gw.wicourts.gov> (raw)
In-Reply-To: <CDFA9340E95A764E9366B4EDF3A43125BCACF7E68D@VA3DIAXVS091.RED001.local>
References: <CDFA9340E95A764E9366B4EDF3A43125BCACF7E68D@VA3DIAXVS091.RED001.local>

David Greco <David_Greco@harte-hanks.com> wrote:
 
> If I change this field from an integer to a real, I get about a
> 70x increase in performance of the query.
 
> I wished to simplify things a bit here (and don't yet know how to
> EXPLAIN ANALYZE a parameterized query).
 
>  carrier_source_id | integer                     |
 
> runtime: 0.108 ms
 
>  carrier_source_id | real                        |
 
> runtime: 0.097 ms
 
This doesn't show the problem, so it's hard to guess the cause. 
Perhaps you can do it with a prepared statement?:
 
http://www.postgresql.org/docs/9.0/interactive/sql-prepare.html
 
Also, plans can be completely different based on the number of rows,
width of the rows, distribution of values, etc.  You may want to
select against the actual tables where you've seen the problem.
 
One tip -- if size permits, try to CLUSTER both tables to avoid any
bloat issues, and VACUUM ANALYZE the tables to ensure that hint bits
are set and statistics are up to date before running the tests.  Run
each test several times in a row to see what affect caching has on
the issue.
 
-Kevin



view thread (8+ messages)  latest in thread

Message-ID: <4D4043530200002500039D99@gw.wicourts.gov>
Permalink:  ../4D4043530200002500039D99@gw.wicourts.gov/
Also on:    postgresql.org/message-id/4D4043530200002500039D99@gw.wicourts.gov

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: Kevin.Grittner@wicourts.gov, David_Greco@harte-hanks.com
  Subject: Re: Real vs Int performance
  In-Reply-To: <4D4043530200002500039D99@gw.wicourts.gov>
  References: <CDFA9340E95A764E9366B4EDF3A43125BCACF7E68D@VA3DIAXVS091.RED001.local> <4D4043530200002500039D99@gw.wicourts.gov>

* 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