SQL-Statement

From: Markus Espenhain <espenhain(at)etes(dot)de>
To: Postgres <pgsql-admin(at)postgresql(dot)org>
Subject: SQL-Statement
Date: 2003-11-13 17:23:27
Message-ID: 20031113172327.GB24750@intranet.etes.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hello,

sorry for my previos mail.
This was a mistake...

I have an problem with the following statement.
This one works fine and give me the results in just a few seconds.

SELECT Monatsbeitrag.lfdid, Daten.Kundennummer FROM Daten, Monatsbeitrag WHERE ((((Daten.Vetrag widerufen = 2 ) AND NOT((Daten.ewmanfrdat IS NULL ) ) ) AND (Monatsbeitrag.ID = Daten.Kundennummer ) ) AND (((Monatsbeitrag.Monat + 14 ) = '2003-10-27 00:00:00'::timestamp ) AND (Monatsbeitrag.Bezahlt = 2 ) ) ) ORDER BY Daten.Name;

When I edit the statement and delete the "NOT" before "Daten.ewmanfrdat IS NULL" the Query works over 15 Minutes.

SELECT Monatsbeitrag.lfdid, Daten.Kundennummer FROM Daten, Monatsbeitrag WHERE ((((Daten.Vetrag widerufen = 2 ) AND ((Daten.ewmanfrdat IS NULL ) ) ) AND (Monatsbeitrag.ID = Daten.Kundennummer )
) AND (((Monatsbeitrag.Monat + 14 ) = '2003-10-27 00:00:00'::timestamp ) AND (Monatsbeitrag.Bezahlt = 2 ) ) ) ORDER BY Daten.Name;

OK, to select a lot of records it works a time, but for only 350 records?

Where is my problem?

Can anybody help me please.

Regards

Markus

--
Markus Espenhain Fon: +49 (7 11) 48 90 83 - 0
ETES - EDV-Systemhaus GbR Fax: +49 (7 11) 48 90 83 - 50
Libanonstrasse 58 A * D-70184 Stuttgart Web: http://www.etes.de

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message scott.marlowe 2003-11-13 18:12:57 Re: easy way to copy all DBs and users on a server
Previous Message bagley@traderonline.com 2003-11-13 16:36:55 Re: can't connect to PostgreSQL Database using pgAdminII