n,
many thanks.
-- Csaba
-Original Message-
From: Tom Lane [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 22, 2004 7:01 PM
To: Együd Csaba (Freemail)
Cc: 'Együd Csaba'; pgsql-general@postgresql.org
Subject: Re: [GENERAL] Strange Index behavior
=?iso-8859-2?Q?Egy=FCd_Csa
=?iso-8859-2?Q?Egy=FCd_Csaba_=28Freemail=29?= <[EMAIL PROTECTED]> writes:
> The difference between the result times is 16x. I can't understand why the
> planner thinks it is the better way...
The planner thinks that because it thinks the second query will fetch
1500 times as many rows as the first
On Wed, Dec 22, 2004 at 18:44:00 +0100,
"Együd Csaba (Freemail)" <[EMAIL PROTECTED]> wrote:
> But why? I thought the planner is for choose the quicker way to the target
> point. If there is an index which is probably would speed up the query then
> why does the planner ignore that?
Because doin
r way...
-- Csaba
-Original Message-
From: Tom Lane [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 22, 2004 6:34 PM
To: Együd Csaba (Freemail)
Cc: 'Együd Csaba'; pgsql-general@postgresql.org
Subject: Re: [GENERAL] Strange Index behavior
=?iso-8859-2?Q?Egy=FCd_Csaba
=?iso-8859-2?Q?Egy=FCd_Csaba_=28Freemail=29?= <[EMAIL PROTECTED]> writes:
> The point is that there are cases where a primary key index is not used -
> even if the condition is formaly good.
You haven't actually shown us such a case. In the case you gave,
I think the planner probably made the rig
-- Csaba
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Tom Lane
Sent: Wednesday, December 22, 2004 5:47 PM
To: Együd Csaba
Cc: [EMAIL PROTECTED]
Subject: Re: [GENERAL] Strange Index behavior
=?iso-8859-2?Q?Egy=FCd_Csaba?= <[EMAIL PROTECTED]> writes:
>
On Wed, Dec 22, 2004 at 03:09:08PM +0100, Együd Csaba wrote:
> Hi,
> Is it a normal behavior that if I give a where clause with an existent index
> key, then postgres uses the index, but if I give it a non existent value
> than it refuses to use the index.
Whether the value exists is irrelevent. W
=?iso-8859-2?Q?Egy=FCd_Csaba?= <[EMAIL PROTECTED]> writes:
> # explain analyze select meterid, tstamp, pp, pm, status from measured_1
> where tstamp >= '2004.12.22 00:00' and tstamp <= '2004.12.22 23:59' order by
> tstamp, meterid;
> "Sort (cost=2619.02..2622.78 rows=1505 width=42) (actual
> time=
Hi,
Is it a normal behavior that if I give a where clause with an existent index
key, then postgres uses the index, but if I give it a non existent value
than it refuses to use the index.
An example to make it more clear:
CREATE TABLE measured_1
(
tstamp timestamp(0) NOT NULL,
meterid int4 NO