Dave Clements | 1 Feb 2010 02:09
Picon

Re: Fwd: Help required on query performance

I did the re-analyze serveral times, using the command:

ANALYZE tablename;

Is there any other command as well or another way to do that?

On Mon, Feb 1, 2010 at 12:04 PM, Scott Marlowe <scott.marlowe <at> gmail.com> wrote:
> On Sun, Jan 31, 2010 at 6:02 PM, Dave Clements <dclements89 <at> gmail.com> wrote:
>> Hi, following the output from explain analyze.
>
> Without doing any heavy analysis, it looks like your row estimates are
> way off.  Have you cranked up stats target and re-analyzed yet?
>

--

-- 
Sent via pgsql-sql mailing list (pgsql-sql <at> postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql

Scott Marlowe | 1 Feb 2010 02:13
Picon

Re: Fwd: Help required on query performance

On Sun, Jan 31, 2010 at 6:09 PM, Dave Clements <dclements89 <at> gmail.com> wrote:
> I did the re-analyze serveral times, using the command:
>
> ANALYZE tablename;
>
> Is there any other command as well or another way to do that?

It's important that the stats target get increased as well, it looks
like you're not getting enough buckets to get a good estimate of rows
to be returned for various conditions.

# show default_statistics_target ;
 default_statistics_target
---------------------------
 10

# alter database smarlowe set default_statistics_target=200;
ALTER DATABASE
# analyze;

Then run the explain analyze again and see if your row estimates are
closer and if the plan changes.

--

-- 
Sent via pgsql-sql mailing list (pgsql-sql <at> postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql

Dave Clements | 1 Feb 2010 02:22
Picon

Re: Fwd: Help required on query performance

After doing an analyze on the database, it improved a lot :)

On Mon, Feb 1, 2010 at 12:13 PM, Scott Marlowe <scott.marlowe <at> gmail.com> wrote:
> On Sun, Jan 31, 2010 at 6:09 PM, Dave Clements <dclements89 <at> gmail.com> wrote:
>> I did the re-analyze serveral times, using the command:
>>
>> ANALYZE tablename;
>>
>> Is there any other command as well or another way to do that?
>
> It's important that the stats target get increased as well, it looks
> like you're not getting enough buckets to get a good estimate of rows
> to be returned for various conditions.
>
> # show default_statistics_target ;
>  default_statistics_target
> ---------------------------
>  10
>
> # alter database smarlowe set default_statistics_target=200;
> ALTER DATABASE
> # analyze;
>
> Then run the explain analyze again and see if your row estimates are
> closer and if the plan changes.
>

--

-- 
Sent via pgsql-sql mailing list (pgsql-sql <at> postgresql.org)
To make changes to your subscription:
(Continue reading)


Gmane