select statment going slow and slow while using IN (xx,xx)

From: Yan Chunlu <springrider(at)gmail(dot)com>
To: pgsql-general General <pgsql-general(at)postgresql(dot)org>
Subject: select statment going slow and slow while using IN (xx,xx)
Date: 2012-01-12 08:47:03
Message-ID: CAOA66tEDD2OpdyNBJpzN_9OxZQ2bE4S3Gn+wc45gY+DMyOz9Tw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I am transforming a db with millions records to anther schema. for
some reason I need to select the records using IN (xx,xx).

the ids in the IN was about 1000 recored every time, but I found the
query was getting slow while the selection moving on.

the shared buffer is 2048M. and the cpu and io usage is as normal.

But while I am processing a smaller db on another machine, which only
has the default 24MB, the selection went very smooth.

here is the logs:

start... 0 limit:1000
selection time: 0.140721082687
sort_options
msgtime
start... 1000 limit:1000
selection time: 0.122759103775
start... 2000 limit:1000
selection time: 0.150802850723
start... 3000 limit:1000
selection time: 0.173918008804
start... 4000 limit:1000
selection time: 0.212812900543
start... 5000 limit:1000
selection time: 0.255054950714
start... 6000 limit:1000
selection time: 0.230540037155
start... 7000 limit:1000
selection time: 0.24426317215
start... 8000 limit:1000
selection time: 0.326669931412
start... 9000 limit:1000
selection time: 0.351358175278
start... 10000 limit:1000
selection time: 0.386382102966
start... 11000 limit:1000
selection time: 0.440491914749
start... 12000 limit:1000
selection time: 0.443608045578
start... 13000 limit:1000
selection time: 0.49751496315
start... 14000 limit:1000
selection time: 12.0050361156
start... 15000 limit:1000
selection time: 26.3596658707

start... 16000 limit:1000
selection time: 43.5269529819

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Yan Chunlu 2012-01-12 09:00:27 Re: select statment going slow and slow while using IN (xx,xx)
Previous Message Craig Ringer 2012-01-12 05:45:06 Re: Compiling C function with VC++ for Windows version