From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Stephen Livesey <ste(at)exact3ex(dot)co(dot)uk>, pgsql-general(at)postgreSQL(dot)org |
Subject: | Re: Slowdown problem when writing 1.7million records |
Date: | 2001-02-28 18:04:00 |
Message-ID: | 200102281804.NAA05650@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> "Stephen Livesey" <ste(at)exact3ex(dot)co(dot)uk> writes:
> >> Further question --- is there any particular pattern to the order in
> >> which you are inserting the records? For example, are they in order
> >> by postcode, or approximately so?
> >
> > Yes they would be inserted in postcode order.
>
> Ah. What must be happening is that the index on postcode is getting
> badly misbalanced --- instead of a roughly symmetrical b-tree, all the
> branches link to the right, causing index insertions and lookups to scan
> the whole index instead of only an O(log N) portion of it. You'd get
> better results if you inserted the data in random order, or dropped the
> index while inserting the data and then recreated it after the bulk
> loading is done.
>
> I am not sure how difficult this behavior might be to change, but in any
> case I'm not going to risk twiddling the btree code at this late stage
> of the 7.1 release cycle. Bruce, would you add a TODO item?
>
> * Be smarter about insertion of already-ordered data into btree index
Added. I thought our btree code was self-balancing.
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
From | Date | Subject | |
---|---|---|---|
Next Message | Marek Pętlicki | 2001-02-28 18:12:50 | pgsql for Python |
Previous Message | Michaël Fiey | 2001-02-28 18:01:53 | Intersect and order by |