BUG #1697: Select getting slower on continously updating data

From: "Bahadur Singh" <bahadursingh(at)yahoo(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #1697: Select getting slower on continously updating data
Date: 2005-06-02 11:05:00
Message-ID: 20050602110500.59D47F0B00@svr2.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-novice pgsql-performance


The following bug has been logged online:

Bug reference: 1697
Logged by: Bahadur Singh
Email address: bahadursingh(at)yahoo(dot)com
PostgreSQL version: 8.0
Operating system: Windows 2000 server
Description: Select getting slower on continously updating data
Details:

Hello,

I found situtation that, when I am selecting data from a table of 200
records, getting slower as I do continous update to the same existing data.

CREATE TABLE salesarticle
(
articlenumber char(20) NOT NULL,
price int4 NOT NULL,
eodid int4 NOT NULL,
departmentnumber char(4) NOT NULL,
keycounter int4 NOT NULL,
scancounter int4 NOT NULL,
grosssalescounter int8 NOT NULL,
grosssalesamount int8 NOT NULL,
discountcounter int8 NOT NULL,
discountamount int8 NOT NULL,
reductioncounter int8 NOT NULL,
reductionamount int8 NOT NULL,
transactioncounter int4 NOT NULL,
promotionamount int8 NOT NULL,
promotioncounter int8 NOT NULL,
datelastsale char(14) NOT NULL,
CONSTRAINT salesarticle_pkey PRIMARY KEY (articlenumber, price, eodid),
CONSTRAINT salesarticle_eodid_fkey FOREIGN KEY (eodid) REFERENCES eodinfo
(eodid) ON UPDATE NO ACTION ON DELETE NO ACTION
)
WITH OIDS;

This is my select statement:

EXPLAIN ANALYZE
SELECT ArticleNumber, Price, EodId FROM SalesArticle WHERE ArticleNumber IN
(' 9502',
' 9500',' 9501',' 9505','
9506',' 9507',' 9515',
' 9516',' 9518',' 9520','
9472',' 9508',' 9546',
' 3322',' 9521' ) AND EodId = 12
"Index Scan using salesarticle_pkey, salesarticle_pkey, salesarticle_pkey,
salesarticle_pkey, salesarticle_pkey, salesarticle_pkey, salesarticle_pkey,
salesarticle_pkey, salesarticle_pkey, salesarticle_pkey, salesarticle_pkey,
salesarticle_pkey, salesarticl (..)"
" Index Cond: ((articlenumber = ' 9502'::bpchar) OR
(articlenumber = ' 9500'::bpchar) OR (articlenumber = '
9501'::bpchar) OR (articlenumber = ' 9505'::bpchar)
OR (articlenumber = ' (..)"
" Filter: (eodid = 12)"
"Total runtime: 47.000 ms"

The first iteration(400 times selects and update that selected data ) say
400 are within 2 sec, then it keep on increasing at the end, it take 9
seconds to execute 100 selects and updates on the database. No new records
are added during this operation.

perfromace of above select degrade as follows
= 16 ms ==> yealds 1600 ms for 100 iteration.
= 32 ms ==> yealds 3200 ms for 100 it...
= 47 ms ==> yealds 4700 ms for 100 it...
= 80 ms ==> yealds 80000 ms for 100 it...
= 104 ms ==> yealds 10400 ms for 100 it...

when I create an index on PK of this table, it boosts select performance to
16 ms, but update stmts are slowing down. I do insert only once in begining
and then update them continously as long I recieve same input data. (means
no insert take place in between on this salesArticle table.)

Please advice me some solution or any trick.

Thanks in Advance,
Bahadur

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruno Wolff III 2005-06-02 13:02:59 Re: BUG #1697: Select getting slower on continously updating data
Previous Message Martin Pitt 2005-06-02 10:23:07 More graceful handling of invalid log_*_stats conf in 7.4

Browse pgsql-novice by date

  From Date Subject
Next Message Bruno Wolff III 2005-06-02 13:02:59 Re: BUG #1697: Select getting slower on continously updating data
Previous Message Tom Lane 2005-06-02 06:19:17 Re: Performance of plpgsql with exception handlers

Browse pgsql-performance by date

  From Date Subject
Next Message Richard Welty 2005-06-02 11:50:22 Re: Adaptec/LSI/?? RAID
Previous Message Andrew McMillan 2005-06-02 09:15:13 Re: Adaptec/LSI/?? RAID