X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EC116D1B220 for ; Thu, 15 Jul 2004 16:36:05 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 36105-01 for ; Thu, 15 Jul 2004 19:36:01 +0000 (GMT) Received: from exchange.rampageusa.net (exchange.dslextreme.com [66.51.198.16]) by svr1.postgresql.org (Postfix) with ESMTP id 48D1ED1B178 for ; Thu, 15 Jul 2004 16:35:59 -0300 (ADT) Content-class: urn:content-classes:message Subject: Wierd issues MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C46AA2.DFA22B87" Date: Thu, 15 Jul 2004 12:35:23 -0700 Message-ID: <79AEF92046759442A4AA04C2AB08C0B814F955@exchange.corp.dslextreme.com> X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Wierd issues Thread-Index: AcRqot8fqDGZ5kzCSnStwp3zWrV8VA== From: "Andrew Matthews" To: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.3 tagged_above=0.0 required=5.0 tests=HTML_50_60, HTML_FONTCOLOR_UNKNOWN, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200407/108 X-Sequence-Number: 7499 This is a multi-part message in MIME format. ------_=_NextPart_001_01C46AA2.DFA22B87 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable I lost the email that had the fix for this and now I need it again... can someone or tom let me know what the fix was, I can't find it in any of my emails or archived on the internet =20 This is what I got... =20 Two servers, one debian, one fedora =20 Debain dual 3ghz, 1 gig ram, ide, PostgreSQL 7.2.1 on i686-pc-linux-gnu, compiled by GCC 2.95.4 =20 =20 Fedora: Dual 3ghz, 1 gig ram, scsi, PostgreSQL 7.3.4-RH on i386-redhat-linux-gnu, compiled by GCC i386-redhat-linux-gcc (GCC) 3.3.2 20031022 (Red Hat Linux 3.3.2-1) =20 =20 Both have same databases, Both have had vacume full ran on them. Both doing the same query =20 Select * from vpopmail; The vpopmail is a view, this is the view =20 =20 View "vpopmail" Column | Type | Modifiers=20 -----------+------------------------+----------- pw_name | character varying(32) |=20 pw_domain | character varying(64) |=20 pw_passwd | character varying |=20 pw_uid | integer |=20 pw_gid | integer |=20 pw_gecos | character varying |=20 pw_dir | character varying(160) |=20 pw_shell | character varying(20) |=20 View definition: SELECT ea.email_name AS pw_name, ea.domain AS pw_domain, get_pwd(u.username, '127.0.0.1'::"varchar", '101'::"varchar", 'MD5'::"varchar") AS pw_passwd, 0 AS pw_uid, 0 AS pw_gid, ''::"varchar" AS pw_gecos, ei.directory AS pw_dir, ei.quota AS pw_shell FROM email_addresses ea, email_info ei, users u, user_resources ur WHERE (((((ea.user_resource_id =3D ei.user_resource_id) AND (get_pwd(u.username, '127.0.0.1'::"varchar", '101'::"varchar", 'MD5'::"varchar") IS NOT NULL)) AND (ur.id =3D ei.user_resource_id)) AND (u.id =3D ur.user_id)) AND (NOT (EXISTS (SELECT forwarding.email_id FROM forwarding WHERE (forwarding.email_id =3D ea.id))))); =20 =20 =20 Both are set to the same buffers and everything... this is the execution time: =20 Debian: Total runtime: 35594.81 msec =20 Fedora: Total runtime: 2279869.08 msec =20 Huge difference as you can see... here are the pastes of the stuff =20 Debain: =20 user_acl=3D# explain analyze SELECT count(*) from vpopmail; NOTICE: QUERY PLAN: =20 Aggregate (cost=3D438231.94..438231.94 rows=3D1 width=3D20) (actual time=3D35594.67..35594.67 rows=3D1 loops=3D1) -> Hash Join (cost=3D434592.51..438142.51 rows=3D35774 width=3D20) (act= ual time=3D34319.24..35537.11 rows=3D70613 loops=3D1) -> Seq Scan on email_info ei (cost=3D0.00..1721.40 rows=3D71640 width=3D4) (actual time=3D0.04..95.13 rows=3D71689 loops=3D1) -> Hash (cost=3D434328.07..434328.07 rows=3D35776 width=3D16) (actual time=3D34319.00..34319.00 rows=3D0 loops=3D1) -> Hash Join (cost=3D430582.53..434328.07 rows=3D35776 width=3D16) (actual time=3D2372.45..34207.21 rows=3D70613 loops=3D1) -> Seq Scan on users u (cost=3D0.00..1938.51 rows=3D71283 width=3D4) (actual time=3D0.81..30119.58 rows=3D70809 loops=3D= 1) -> Hash (cost=3D430333.64..430333.64 rows=3D35956 width=3D12) (actual time=3D2371.51..2371.51 rows=3D0 loops=3D1) -> Hash Join (cost=3D2425.62..430333.64 rows=3D35956 width=3D12) (actual time=3D176.73..2271.14 rows=3D71470 loops= =3D1) -> Seq Scan on email_addresses ea (cost=3D0.00..426393.25 rows=3D35956 width=3D4) (actual time=3D0.06..627.49 rows=3D71473 loops=3D1) SubPlan -> Index Scan using forwarding_idx on forwarding (cost=3D0.00..5.88 rows=3D1 width=3D4) (actual time=3D0.00..0.00 rows=3D0 loops=3D71960) -> Hash (cost=3D1148.37..1148.37 rows=3D71637 width=3D8) (actual time=3D176.38..176.38 rows=3D0 loops=3D1) -> Seq Scan on user_resources ur (cost=3D0.00..1148.37 rows=3D71637 width=3D8) (actual time=3D0.03..82.21 rows=3D71686 loops=3D1) Total runtime: 35594.81 msec =20 EXPLAIN =20 =20 =20 And for fedora it's =20 =20 Aggregate (cost=3D416775.52..416775.52 rows=3D1 width=3D20) (actual time=3D2279868.57..2279868.58 rows=3D1 loops=3D1) -> Hash Join (cost=3D413853.79..416686.09 rows=3D35772 width=3D20) (actual time=3D2279271.26..2279803.91 rows=3D70841 loops=3D1) Hash Cond: ("outer".user_resource_id =3D "inner".id) -> Seq Scan on email_info ei (cost=3D0.00..1666.07 rows=3D71907 width=3D4) (actual time=3D8.12..171.10 rows=3D71907 loops=3D1) -> Hash (cost=3D413764.36..413764.36 rows=3D35772 width=3D16) (actual time=3D2279263.03..2279263.03 rows=3D0 loops=3D1) -> Hash Join (cost=3D410712.87..413764.36 rows=3D35772 width=3D16) (actual time=3D993.90..2279008.72 rows=3D70841 loops=3D1) Hash Cond: ("outer".id =3D "inner".user_id) -> Seq Scan on users u (cost=3D0.00..1888.85 rows=3D71548 width=3D4) (actual time=3D18.38..2277152.51 rows=3D71028 loops= =3D1) Filter: (get_pwd(username, '127.0.0.1'::character varying, '101'::character varying, 'MD5'::character varying) IS NOT NULL) -> Hash (cost=3D410622.99..410622.99 rows=3D35952 width=3D12) (actual time=3D975.40..975.40 rows=3D0 loops=3D1) -> Hash Join (cost=3D408346.51..410622.99 rows=3D35952 width=3D12) (actual time=3D507.52..905.91 rows=3D71697 loops= =3D1) Hash Cond: ("outer".id =3D "inner".user_resource_id) -> Seq Scan on user_resources ur (cost=3D0.00..1108.04 rows=3D71904 width=3D8) (actual time=3D0.05..95.65 rows=3D71904 loops=3D1) -> Hash (cost=3D408256.29..408256.29 rows=3D36091 width=3D4) (actual time=3D507.33..507.33 rows=3D0 loops=3D1) -> Seq Scan on email_addresses ea (cost=3D0.00..408256.29 rows=3D36091 width=3D4) (actual time=3D0.15..43= 2.83 rows=3D71700 loops=3D1) Filter: (NOT (subplan)) SubPlan -> Index Scan using forwarding_idx on forwarding (cost=3D0.00..5.63 rows=3D1 width=3D4) (actual time=3D0.00..0.00 rows=3D0 loops=3D72182) Index Cond: (email_id =3D $0) Total runtime: 2279869.08 msec (20 rows) ------_=_NextPart_001_01C46AA2.DFA22B87 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

I lost the email that had the fix for = this and now I need it again… can someone or tom let me know what the fix = was, I can’t find it in any of my emails or archived on the internet<= /o:p>

 

This is what I got…

 

Two servers, one debian, one fedora

 

Debain dual 3ghz, 1 gig ram, ide, PostgreSQL 7.2.1 on i686-pc-linux-gnu, compiled by GCC 2.95.4

 

 

Fedora: Dual 3ghz, 1 gig ram, scsi, PostgreSQL 7.3.4-RH = on i386-redhat-linux-gnu, compiled by GCC i386-redhat-linux-gcc (GCC) 3.3.2 20031022 (Red Hat Linux 3.3.2-1)

 

 

Both have same databases, Both have had vacume full ran = on them. Both doing the same query

 

Select * from vpopmail; The vpopmail is a view, this is = the view

 

 

         &n= bsp;      View "vpopmail"

  Column   |          Type          | Modifiers

-----------+------------------------+-----------

 pw_name   | character varying(32)  = |

 pw_domain | character varying(64)  |

 pw_passwd | character varying      |

 pw_uid    | integer           &n= bsp;    |

 pw_gid    | integer           &n= bsp;    |

 pw_gecos  | character varying      |

 pw_dir    | character varying(160) = |

 pw_shell  | character varying(20)  |

View definition: SELECT ea.email_name AS pw_name, ea.dom= ain AS pw_domain, get_pwd(u.username, '127.0.0.1'::"varchar", '101'::"varchar", 'MD5'::"varchar") AS pw_passwd, 0 AS pw_uid, 0 AS pw_gid, ''::"varchar" AS pw_gecos, ei.directory AS pw_dir, ei.quota AS pw_shell FROM email_addresses ea, email_info ei, users = u, user_resources ur WHERE (((((ea.user_resource_id =3D ei.user_resource_id) A= ND (get_pwd(u.username, '127.0.0.1'::"varchar", '101'::"varchar", 'MD5'::"varchar") IS NOT NULL)) AND (ur.id =3D ei.user_resource_id)) AND (u.id =3D ur.user_id)) AND (NOT (EXISTS (SELECT forwarding.email_id FROM forwarding WHERE (forwarding.email_id =3D ea.id)))));

 

 

 

Both are set to the same buffers and everything… t= his is the execution time:

 

Debian: Total runtime: 35594.81 msec

 

Fedora: Total runtime: 2279869.08 msec=

 

Huge difference as you can see… here are the paste= s of the stuff

 

Debain:

 

user_acl=3D# explain analyze SELECT count(*) from vpopma= il;

NOTICE:  QUERY PLAN:

 

Aggregate  (cost=3D438231.94..438231.94 rows=3D1 wi= dth=3D20) (actual time=3D35594.67..35594.67 rows=3D1 loops=3D1)

  ->  Hash Join  (cost=3D434592.51..438142.51 rows=3D35774 width=3D20) (actual time=3D34319.= 24..35537.11 rows=3D70613 loops=3D1)

        ->  S= eq Scan on email_info ei  (cost=3D0.00..1721.40 rows=3D71640 width=3D4) (= actual time=3D0.04..95.13 rows=3D71689 loops=3D1)

        ->  Hash  (cost=3D434328.07..434328.07 rows=3D35776 width=3D16) (actual time=3D34319.00..34319.00 rows=3D0 loops=3D1)

         &n= bsp;    ->  Hash Join  (cost=3D430582.53..434328.07 rows=3D35776 width= =3D16) (actual time=3D2372.45..34207.21 rows=3D70613 loops=3D1)<= /font>

         &n= bsp;          ->  Seq Scan on users u  (cost=3D0.00..1938.51 rows=3D71283 wi= dth=3D4) (actual time=3D0.81..30119.58 rows=3D70809 loops=3D1)

         &n= bsp;          ->  Hash  (cost=3D430333.64..430333.64 rows=3D35956 width=3D12= ) (actual time=3D2371.51..2371.51 rows=3D0 loops=3D1)

         &n= bsp;            = ;    ->  Hash Join  (cost=3D2425.62..430333.64 rows=3D35956 width= =3D12) (actual time=3D176.73..2271.14 rows=3D71470 loops=3D1)

         &n= bsp;            = ;          ->  Seq Scan on email_addresses ea  (cost=3D0.00..426393.25 rows=3D35956 width=3D4) (actual time=3D0.06..627.49 rows=3D71473 loops=3D1)=

         &n= bsp;            = ;            &n= bsp;   SubPlan

         &n= bsp;            = ;            &n= bsp;     ->  Index Scan using forwarding_idx on forwarding  (cost=3D0.00..5.88 rows=3D1 width=3D4) (actual time=3D0.00..0.00 rows=3D0 l= oops=3D71960)

                 &nb= sp;            =   ->  Hash  (cost=3D1148.37..1148.37 rows=3D71637 width=3D8) (actual time=3D176.38..176.38 rows=3D0 loops=3D1)

         &n= bsp;            = ;            &n= bsp;   ->  Seq Scan on user_resources ur  (cost=3D0.00..1148.37 rows=3D71637 width=3D8) (actual time=3D0.03..82.21 ro= ws=3D71686 loops=3D1)

Total runtime: 35594.81 msec

 

EXPLAIN

 

 

 

And for fedora it’s

 

 

Aggregate  (cost=3D416775.52..416775.52 row=
s=3D1 width=3D20) (actual time=3D2279868.57..2279868.58 rows=3D1 loops=3D1)=
   ->  Hash Join  (cost=
=3D413853.79..416686.09 rows=3D35772 width=3D20) (actual time=3D2279271.26.=
.2279803.91 rows=3D70841 loops=3D1)
        =
 Hash Cond: ("outer".user_resource_id =3D "inner".id)
        =
 ->  Seq Scan on email_info ei  (cost=3D0.00..1666.07 rows=3D7=
1907 width=3D4) (actual time=3D8.12..171.10 rows=3D71907 loops=3D1)
        =
 ->  Hash  (cost=3D413764.36..413764.36 rows=3D35772 width=3D1=
6) (actual time=3D2279263.03..2279263.03 rows=3D0 loops=3D1)
        =
       ->  Hash Join  (cost=3D41=
0712.87..413764.36 rows=3D35772 width=3D16) (actual time=3D993.90..2279008.=
72 rows=3D70841 loops=3D1)
        =
             Ha=
sh Cond: ("outer".id =3D "inner".user_id)
        =
             -&=
gt;  Seq Scan on users u  (cost=3D0.00..1888.85 rows=3D71548 widt=
h=3D4) (actual time=3D18.38..2277152.51 rows=3D71028 loops=3D1)<=
/span>
        =
            &nb=
sp;      Filter: (get_pwd(username, '127.0.0.1'::c=
haracter varying, '101'::character varying, 'MD5'::character varying) IS NO=
T NULL)
        =
             -&=
gt;  Hash  (cost=3D410622.99..410622.99 rows=3D35952 width=3D12) =
(actual time=3D975.40..975.40 rows=3D0 loops=3D1)<=
/pre>
        =
             &n=
bsp;     ->  Hash Join  (cost=3D40834=
6.51..410622.99 rows=3D35952 width=3D12) (actual time=3D507.52..905.91 rows=
=3D71697 loops=3D1)
        =
            &nb=
sp;            Hash =
Cond: ("outer".id =3D "inner".user_resource_id)
        =
            &nb=
sp;            ->=
  Seq Scan on user_resources ur  (cost=3D0=
.00..1108.04 rows=3D71904 width=3D8) (actual time=3D0.05..95.65 rows=3D7190=
4 loops=3D1)
        =
            &nb=
sp;            ->=
  Hash  (cost=3D408256.29..408256.29 rows=3D36091 width=3D4) (act=
ual time=3D507.33..507.33 rows=3D0 loops=3D1)
        =
             &n=
bsp;            =
;     ->  Seq Scan on email_addresses ea&n=
bsp; (cost=3D0.00..408256.29 rows=3D36091 width=3D4) (actual time=3D0.15..4=
32.83 rows=3D71700 loops=3D1)
        =
            &nb=
sp;            =
            Filter: =
(NOT (subplan))
        =
            &nb=
sp;            =
            SubPlan<=
o:p>
        =
            &nb=
sp;            =
            &nb=
sp; ->  Index Scan using forwarding_idx on forwarding  (cost=
=3D0.00..5.63 rows=3D1 width=3D4) (actual time=3D0.00..0.00 rows=3D0 loops=
=3D72182)
        =
            &nb=
sp;            =
            &nb=
sp;       Index Cond: (email_id =3D $0)<=
/o:p>
 Total runtime: 2279869.08 msec

(20 rows)

------_=_NextPart_001_01C46AA2.DFA22B87--