Re: [GENERAL] Weird query plan

2003-09-17 Thread Dmitry Tkach
P.S. I also tried to look at the stats of that other database I mentioned... The stats for b look similar: stavalues1 | {1028104,25100079,50685614,78032989,105221902,135832793,199827486,611968165,807597786,884897604,969971779} But the stats for a are just *not there at all* (is it even possibl

Re: [GENERAL] Weird query plan

2003-09-17 Thread Dmitry Tkach
Tom Lane wrote: Dmitry Tkach <[EMAIL PROTECTED]> writes: Also, I have another copy (not exact copy, but identical schema, and similar content... but about twice smaller) of the original database... I tried my query on it, and it works right too. So, there must be something wrong with

Re: [GENERAL] Weird query plan

2003-09-17 Thread Tom Lane
Dmitry Tkach <[EMAIL PROTECTED]> writes: > Also, I have another copy (not exact copy, but identical schema, and > similar content... but about twice smaller) of the original database... > I tried my query on it, and it works right too. > So, there must be something wrong with that particular dat

Re: [GENERAL] Weird query plan

2003-09-17 Thread Dmitry Tkach
Hmmm... Indeed. I tried it in 7.2.4 on a couple of empty tables, and it does do the right thing... Also, I have another copy (not exact copy, but identical schema, and similar content... but about twice smaller) of the original database... I tried my query on it, and it works right too. So, ther

Re: [GENERAL] Weird query plan

2003-09-17 Thread Tom Lane
Dmitry Tkach <[EMAIL PROTECTED]> writes: > The query plan looks identical in both cases: > Limit (cost=0.00..12.51 rows=1 width=8) > -> Nested Loop (cost=0.00..1009772807.91 rows=80740598 width=8) > -> Index Scan using b_pkey on b (cost=0.00..375410773.29 > rows=80740598 width=4) >

[GENERAL] Weird query plan

2003-09-17 Thread Dmitry Tkach
Hi, everybody! Here is a weird problem, I ran into... I have two huge (80 million rows each) tables (a and b), with id as a PK on both of them and also an FK from b referencing a. When I try to run a query like: select * from a, b where a.id >= 7901288 and a.id=b.id limit 1; The query takes *f