pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bahadur Singh <bahadursingh@yahoo.com>
To: pgsql-bugs@postgresql.org
Subject: BUG #1697: Select getting slower on continously updating data
Date: Thu,  2 Jun 2005 12:05:00 +0100 (BST)
Message-ID: <20050602110500.59D47F0B00@svr2.postgresql.org> (raw)


The following bug has been logged online:

Bug reference:      1697
Logged by:          Bahadur Singh
Email address:      bahadursingh@yahoo.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



view thread (4+ messages)  latest in thread

Message-ID: <20050602110500.59D47F0B00@svr2.postgresql.org>
Permalink:  ../20050602110500.59D47F0B00@svr2.postgresql.org/
Also on:    postgresql.org/message-id/20050602110500.59D47F0B00@svr2.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: bahadursingh@yahoo.com, pgsql-bugs@postgresql.org
  Subject: Re: BUG #1697: Select getting slower on continously updating data
  In-Reply-To: <20050602110500.59D47F0B00@svr2.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox