Re: [GENERAL] why sequential scan is used on indexed column ???

2008-06-16 Thread Michael Fuhr
On Sat, Jun 14, 2008 at 02:35:38PM -0400, Tom Lane wrote: > Michael Fuhr <[EMAIL PROTECTED]> writes: > > I created a test case that has close to the same estimated and > > actual row counts and has the same plan if I disable enable_nestloop: > > There's something weird about this --- why does the

Re: [GENERAL] why sequential scan is used on indexed column ???

2008-06-15 Thread Julius Tuskenis
Hi Michael. Thank you for your answer. I've checked - enable_nestloop is true. I did ANALYZE, but that didn't help. The sequential scan is still used Any more ideas why? Julius Tuskenis Michael Fuhr rašė: On Sat, Jun 14, 2008 at 04:59:44PM +0200, Andreas Kretschmer wrote: Julius T

Re: [GENERAL] why sequential scan is used on indexed column ???

2008-06-15 Thread Julius Tuskenis
Hello, Tom. So I think the OP's problem is purely a statistical one, or maybe he's in a situation where he should reduce random_page_cost.) What could be done solving that "statistical problem"? :) Current value for random_page_cost is 4. What value would you suggest? Julius Tuskenis -

Re: [GENERAL] why sequential scan is used on indexed column ???

2008-06-15 Thread Andreas Kretschmer
Michael Fuhr <[EMAIL PROTECTED]> schrieb: > On Sat, Jun 14, 2008 at 04:59:44PM +0200, Andreas Kretschmer wrote: > > Julius Tuskenis <[EMAIL PROTECTED]> schrieb: > > > I have a question concerning performance. One of my queries take a long > > > to execute. I tried to do "explain analyse" and I s

Re: [GENERAL] why sequential scan is used on indexed column ???

2008-06-14 Thread Tom Lane
Michael Fuhr <[EMAIL PROTECTED]> writes: > I created a test case that has close to the same estimated and > actual row counts and has the same plan if I disable enable_nestloop: There's something weird about this --- why does the second plan seqscan b_saskaita, instead of using the bitmap scan tha

Re: [GENERAL] why sequential scan is used on indexed column ???

2008-06-14 Thread Michael Fuhr
On Sat, Jun 14, 2008 at 04:59:44PM +0200, Andreas Kretschmer wrote: > Julius Tuskenis <[EMAIL PROTECTED]> schrieb: > > I have a question concerning performance. One of my queries take a long > > to execute. I tried to do "explain analyse" and I see that the > > sequential scan is being used, al

Re: [GENERAL] why sequential scan is used on indexed column ???

2008-06-14 Thread Andreas Kretschmer
Julius Tuskenis <[EMAIL PROTECTED]> schrieb: > Hello. > > I have a question concerning performance. One of my queries take a long > to execute. I tried to do "explain analyse" and I see that the > sequential scan is being used, although I have indexes set on columns > that are used in joins.

[GENERAL] why sequential scan is used on indexed column ???

2008-06-14 Thread Julius Tuskenis
Hello. I have a question concerning performance. One of my queries take a long to execute. I tried to do "explain analyse" and I see that the sequential scan is being used, although I have indexes set on columns that are used in joins. The question is - WHY, and how to change that behavior???

Re: [GENERAL] Why sequential scan for currval?

2005-04-27 Thread Klint Gore
On Wed, 27 Apr 2005 00:28:18 -0700, John Barham <[EMAIL PROTECTED]> wrote: > test=# create table tt (id serial unique, s varchar); > [populate tt w/ 10 rows] > test=# insert into tt (s) values ('foo'); > test=# select currval('tt_id_seq'); > currval > - > 12 > (1 row) > test=# ex

[GENERAL] Why sequential scan for currval?

2005-04-27 Thread John Barham
test=# create table tt (id serial unique, s varchar); [populate tt w/ 10 rows] test=# insert into tt (s) values ('foo'); test=# select currval('tt_id_seq'); currval - 12 (1 row) test=# explain select s from tt where id = 12; QUERY PLAN ---

Re: [GENERAL] Why sequential scan for currval?

2005-04-27 Thread John Barham
> test=# explain select s from tt where id = currval('tt_id_key'); > QUERY PLAN > -- > Seq Scan on tt (cost=0.00..1734.42 rows=1 width=32) >Filter: (id = currval('tt_id_key'::text)) > (2 rows) should be: test=# explai

Re: [GENERAL] why sequential scan

2001-08-16 Thread newsreader
On Thu, Aug 16, 2001 at 08:10:41PM -0400, [EMAIL PROTECTED] wrote: > Ok I set enable_hashjoin and enable_mergejoin to off > and performance is much much worse: just over 1 second > job becomes a minute job > > Perhaps I should re-check if the database > gets bigger. > > Thanks a lot > > On Thu,

Re: [GENERAL] why sequential scan

2001-08-16 Thread newsreader
Two estimates I undestand are quite good. select distinct id on body_index where string='book' returns about 1500 rows. That matches with the bottom line of the plan There are 5139 rows in table item. It is the same number of rows in the plan for sequential scan If I were doing a maual join

Re: [GENERAL] why sequential scan

2001-08-16 Thread Tom Lane
[EMAIL PROTECTED] writes: > Can someone explain why pg is doing > a sequential scan on table item with the following > statement Looks like a fairly reasonable plan to me, if the rows estimates are accurate. Are they? regards, tom lane ---(end of

[GENERAL] why sequential scan

2001-08-16 Thread newsreader
Can someone explain why pg is doing a sequential scan on table item with the following statement - q=> explain select distinct h.id,i.item,i.heading,i.finish from item i ,body_index h where h.id=i.item and (h.string='book') order by finish; NOTICE: QUERY PLAN: Unique (cost=6591.46..6606.5