<depesz@depesz.com> wrote:
> On Mon, May 26, 2008 at 04:32:50PM -0700, mark wrote:
>> >> EXPLAIN ANALYZE select * from pokes where uid = 578439028 order by id
>> >> DESC limit 6;
>> > The estimate is way off, when was the last time Vaccum was on the table?
>> about a week ago i ran this VACUUM VERBOSE ANALYZE;
>> this table is never updated or deleted, rows are just inserted...
>
> 1. boost default_statistics_target
> 2. run analyze more often - daily job for example
> 3. create index q on pokes (uid, id); should help
OK I did this
ALTER TABLE pokes ALTER uid set statistics 500;
ALTER TABLE
ANALYZE pokes;
ANALYZE
and then it became super fast!! thanks a lot!!!
my question:
-> is 500 too high? what all does this affect?
-> now increasing this number does it affect only when i am running
analyze commands, or will it slow down inserts and other operations?
EXPLAIN ANALYZE select * from pokes where uid = 578439028 order by id
desc limit 6;
QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------------------
Limit (cost=467.80..467.81 rows=6 width=134) (actual
time=0.016..0.016 rows=0 loops=1)
-> Sort (cost=467.80..468.09 rows=117 width=134) (actual
time=0.016..0.016 rows=0 loops=1)
Sort Key: id
Sort Method: quicksort Memory: 25kB
-> Index Scan using idx_pokes_uid on pokes
(cost=0.00..465.70 rows=117 width=134) (actual time=0.011..0.011
rows=0 loops=1)
Index Cond: (uid = 578439028)
Total runtime: 0.037 ms
--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance
No comments:
Post a Comment