From: | Bill Shui <wshui(at)cse(dot)unsw(dot)edu(dot)au> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | performance difference between pgsql and SQL |
Date: | 2003-10-11 07:17:13 |
Message-ID: | 20031011071713.GA19886@cse.unsw.EDU.AU |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
I am using postgreSQL 7.3.4
I have a single table in the databasse.
mytable(id, tag, parent, label)
all in int8.
hash index is built for id and btree index for all attributes.
now, I have over 9 million tuples in the table.
The problem is when I access the database through
psql interface, where I issued the following query:
select tag from mytable where id = 1;
it took 51880 milliseconds to execute.
the "explain" command showed it used seq scan.
I turned enable_seqscan and enable_nestloop off, and it still
used seqscan.
however, if I call it through a pgsql function, it only took
aobut 0.17 milliseconds.
create function test_tag(int8) returns int8 as'
declare
begin
return tag from mytable where id = $1;
end;
' language 'plpgsql';
This looks like a bug to me.
--
Bill Shui
From | Date | Subject | |
---|---|---|---|
Next Message | Gavin Sherry | 2003-10-11 08:41:24 | Re: performance difference between pgsql and SQL |
Previous Message | Dann Corbit | 2003-10-11 05:22:03 | Re: 2-phase commit |