Re: [GENERAL] table full scan or index full scan?

2009-10-12 Thread Martijn van Oosterhout
On Sun, Oct 11, 2009 at 10:01:52PM -0500, Peter Hunsberger wrote: This is interesting, I just ran a similar issue the other day. Clearly there is a wide range of read / write scenarios that Postgres should be able to cover. These days, I have a lot of designs leaning more toward the data

Re: [GENERAL] table full scan or index full scan?

2009-10-12 Thread peixubin
I understood , thanks. --- 09年10月12日,周一, Martijn van Oosterhout klep...@svana.org 写道: 发件人: Martijn van Oosterhout klep...@svana.org 主题: Re: [GENERAL] table full scan or index full scan? 收件人: Peter Hunsberger peter.hunsber...@gmail.com 抄送: Scott Marlowe scott.marl...@gmail.com, ?? peixu

[GENERAL] table full scan or index full scan?

2009-10-11 Thread 旭斌 裴
I have a 30,000,000 records table, counts the record number to need for 40 seconds. The table has a primary key on column id; perf=# explain select count(*) from test; ... - Aggregate (cost=603702.80..603702.81 rows=1 width=0)   - Seq scan on test

Re: [GENERAL] table full scan or index full scan?

2009-10-11 Thread Greg Smith
On Mon, 12 Oct 2009, ?? ? wrote: perf=# select count(*) from test; In PostgreSQL, if you're selecting every record from the table for a count of them, you have to visit them all no matter what. The most efficient way to do that is with a full table scan. Using an index instead requires

Re: [GENERAL] table full scan or index full scan?

2009-10-11 Thread Scott Marlowe
Real quick, plain text is preferred on these lists over html. I don't care myself so much. On Sun, Oct 11, 2009 at 7:17 PM, 旭斌 裴 peixu...@yahoo.com.cn wrote: I have a 30,000,000 records table, counts the record number to need for 40 seconds. The table has a primary key on column id;

Re: [GENERAL] table full scan or index full scan?

2009-10-11 Thread Peter Hunsberger
2009/10/11 Scott Marlowe scott.marl...@gmail.com: The postgresql database uses the table full scan.but in oracle, the similar SQL uses the index full scanning,speed quickly many than postgresql. Yep, PostgreSQL isn't Oracle.  It's a trade off.  In pgsql indexes don't contain visibility info,