Skip site navigation (1) Skip section navigation (2)

Re: Mysql 321 - Mysql 322 - msql

From: The Hermit Hacker <scrappy(at)hub(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Mysql 321 - Mysql 322 - msql
Date: 1998-11-28 21:14:32
Message-ID: Pine.BSF.4.05.9811281714060.4737-100000@thelab.hub.org (view raw or flat)
Thread:
Lists: pgsql-hackers

On Sat, 28 Nov 1998, The Hermit Hacker wrote:

> On Sat, 28 Nov 1998, John Fieber wrote:
> 
> > In working with the two, I've also found a couple complicated
> > join queries where I just couldn't get the optimizer in
> > PostgreSQL (6.3.2 and 6.4) to do the right thing, resulting in
> > several minutes of processing per query, while mySQL did the same
> > query in the blink of an eye.
> 
> 	You mention v6.4 above, so could you provide us with a way of
> "reproducing" the bug?

Attached is the database scheme from pg_dump (there are a bunch
of extraneous tables in the context of this query). I make no
claims at all about the quality of the database design or the
query, but both Sybase and mySQL execute it very quickly while
PostgreSQL refuses to use the index on the codes table.

$sheet in the query is the "user input" to and is an integer.

(For the curious, this is part of
http://fallout.campusview.indiana.edu/mapfinder.  I can supply
data if needed.)

-john

    	SELECT
	    sheet.sheet_id,
	    sheet.name,
    	    sheet.number,
    	    sheet.note,
    	    cat.call,
    	    cat.series,
    	    cat.main_entry,
    	    sheet.scale,
    	    ca.name as mtype,
    	    cb.name as prod,
    	    cc.name as proj,
    	    cd.name as pm,
    	    ce.name as format,
    	    sheet.coords
    	FROM
	    sheet,
	    cat,
	    codes ca,
	    codes cb,
	    codes cc,
	    codes cd,
	    codes ce
    	WHERE
	    sheet.sheet_id = $sheet 
    	    AND sheet.cat_id = cat.cat_id
	    AND sheet.mtype = ca.code_id
	    AND sheet.prod = cb.code_id
	    AND sheet.proj = cc.code_id
	    AND sheet.pm = cd.code_id
	    AND sheet.format = ce.code_id


--0-1134614595-912283854=:795
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="mf.schema"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine(dot)BSF(dot)4(dot)05(dot)9811281510540(dot)795(at)fallout(dot)campusview(dot)indiana(dot)edu>
Content-Description: mapfinder schema
Content-Disposition: attachment; filename="mf.schema"

Q1JFQVRFIFRBQkxFICJvcGVuZmllbGRzIiAoInNoZWV0X2lkIiAiaW50NCIs
ICJjb2RlIiAiaW50MiIsICJ2YWx1ZSIgImludDQiKTsNCkNSRUFURSBUQUJM
RSAiY29kZXMiICgiY29kZV9pZCIgImludDQiLCAibmFtZSIgInRleHQiKTsN
CkNSRUFURSBUQUJMRSAiY2F0IiAoImNhdF9pZCIgImludDQiLCAiY2FsbCIg
InRleHQiLCAibWFpbl9lbnRyeSIgInRleHQiLCAic2VyaWVzIiAidGV4dCIp
Ow0KQ1JFQVRFIFRBQkxFICJzaGVldCIgKCJmaWxfbm8iICJpbnQ0IiwgInNo
ZWV0X2lkIiAiaW50NCIsICJuYW1lIiAidGV4dCIsICJudW1iZXIiICJ0ZXh0
IiwgIm5vdGUiICJ0ZXh0IiwgImhvbGRpbmdzIiAiaW50MiIsICJjYXRfaWQi
ICJpbnQ0IiwgIm10eXBlIiAiaW50MiIsICJwcm9kIiAiaW50MiIsICJwcm9q
IiAiaW50MiIsICJwbSIgImludDIiLCAiZm9ybWF0IiAiaW50MiIsICJzY2Fs
ZSIgImludDQiLCAiY29vcmRzIiAiYm94Iik7DQpDUkVBVEUgVEFCTEUgImdu
aXNfc3RhdGUiICgiaWQiICJpbnQ0IiwgImFiYnJldiIgdmFyY2hhcig0KSwg
Im5hbWUiICJ0ZXh0Iik7DQpDUkVBVEUgVEFCTEUgImduaXNfZnR5cGUiICgi
aWQiICJpbnQ0IiwgImFiYnJldiIgY2hhcig4KSwgIm5hbWUiICJ0ZXh0Iik7
DQpDUkVBVEUgVEFCTEUgImduaXNfY291bnR5IiAoImlkIiAiaW50NCIsICJz
dGF0ZSIgImludDQiLCAibmFtZSIgInRleHQiKTsNCkNSRUFURSBUQUJMRSAi
Z25pcyIgKCJmbmFtZSIgInRleHQiLCAiZm5hbWV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pc19jb3VudHkiIHVz
aW5nIGJ0cmVlICggImlkIiAiaW50NF9vcHMiICk7DQpDUkVBVEUgIElOREVY
ICJnbmlzX2kiIG9uICJnbmlzIiB1c2luZyBidHJlZSAoICJmbmFtZV9sYyIg
InRleHRfb3BzIiApOw0K
--0-1134614595-912283854=:795--



pgsql-hackers by date

Next:From: Tom LaneDate: 1998-11-28 23:29:51
Subject: New platform-specific FAQ for HPUX
Previous:From: Tom LaneDate: 1998-11-28 20:30:34
Subject: Re: [HACKERS] DROPping tables with SERIALs

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group