Re: PostgreSQL Query Speed Issues

From: Daniel Staal <DStaal(at)usa(dot)net>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: PostgreSQL Query Speed Issues
Date: 2013-02-21 23:34:55
Message-ID: 82FD1007FBDCB8F82EC43F1A@[192.168.1.50]
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

--As of February 21, 2013 4:55:03 PM -0600, Joseph Pravato is alleged to
have said:

>>> # rows in contact: 574939
>>> # rows in contact_address_map: 574924
>> After loading this data, did you run an ANALYZE?
> No we did not, why would this be useful?

--As for the rest, it is mine.

Because it would let the database collect information on how the data is
stored and distributed, thereby giving it a better chance to choose the
best query plan. (Things like: What are common values, what are ranges of
values, etc. If half the database has the same zip code, using an index
for the zip code isn't useful for that zip code. If it's an even
distribution, it is. ANALYZE lets the database figure that out.)

Recent versions of PostgreSQL will periodically do this in the background,
but doing it explicitly in the foreground after major uploads of data is
almost always a good idea.

Daniel T. STaal

---------------------------------------------------------------
This email copyright the author. Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes. This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---------------------------------------------------------------

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Paul Smith 2013-02-22 05:17:19 Re: minimum hardware requirements for small postgres db
Previous Message Joseph Pravato 2013-02-21 22:55:03 Re: PostgreSQL Query Speed Issues