Received: from maia.hub.org (maia-4.hub.org [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 93964632BCC for ; Tue, 11 May 2010 18:58:19 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 60801-10 for ; Tue, 11 May 2010 21:58:12 +0000 (UTC) X-Greylist: delayed 00:09:34.031539 by SQLgrey-1.7.6 Received: from bill.kwcorp.com (mailx.kwcorp.com [65.118.99.196]) by mail.postgresql.org (Postfix) with ESMTP id 4646B632280 for ; Tue, 11 May 2010 18:58:12 -0300 (ADT) X-TM-IMSS-Message-ID: <4e28910d0005773f@kwcorp.com> Received: from gw.homedecorators.com ([172.23.217.142]) by kwcorp.com ([192.168.85.25]) with ESMTP (TREND IMSS SMTP Service 7.0) id 4e28910d0005773f ; Tue, 11 May 2010 16:48:33 -0500 Received: from HDC_MTA-MTA by gw.homedecorators.com with Novell_GroupWise; Tue, 11 May 2010 16:48:34 -0500 Message-Id: <4BE98A2A.2E1C.0042.0@homedecorators.com> X-Mailer: Novell GroupWise Internet Agent 7.0.2 HP Date: Tue, 11 May 2010 16:47:38 -0500 From: "Jorge Montero" To: "venu madhav" , Subject: Re: Performance issues when the number of records are around 10 Million References: In-Reply-To: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="=__Part705ADF6A.1__=" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.899 tagged_above=-10 required=5 tests=BAYES_00=-1.9, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 201005/53 X-Sequence-Number: 38637 This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part705ADF6A.1__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable First, are you sure you are getting autovacuum to run hourly? Autovacuum = will only vacuum when certain configuration thresholds are reached. You = can set it to only check for those thresholds every so often, but no = vacuuming or analyzing will be done unless they are hit, regardless of how = often autovacuum checks the tables. Whenever you are dealing with time = series, the default thresholds are often insufficient, especially when you = are especially interested in the last few records on a large table.=20 =20 What are your autovacuum configuration parameters? When were the two tables last autovacuum and analyzed, according to = pg_stat_user_tables? Could you post the output of explain analyze of your query? Which default statistic collection parameters do you use? Have you changed = them specifically for the tables you are using? Which version of Postgres are you running? Which OS?=20 =20 =20 >>> venu madhav 05/11/10 3:47 AM >>> Hi all, In my database application, I've a table whose records can reach 10M and = insertions can happen at a faster rate like 100 insertions per second in = the peak times. I configured postgres to do auto vacuum on hourly basis. I = have frontend GUI application in CGI which displays the data from the = database. When I try to get the last twenty records from the database, it = takes around 10-15 mins to complete the operation.This is the query which = is used: select e.cid, timestamp, s.sig_class, s.sig_priority, s.sig_name, = e.sniff_ip, e.sniff_channel, s.sig_config, e.wifi_addr_1, e.wifi_addr_2, e.view_status, bssid FROM event e, signature s WHERE = s.sig_id =3D e.signature AND e.timestamp >=3D '1270449180' AND e.timestamp = < '1273473180' ORDER BY e.cid DESC, e.cid DESC limit 21 offset 10539780; Can any one suggest me a better solution to improve the performance. Please let me know if you've any further queries. Thank you, Venu=20 --=__Part705ADF6A.1__= Content-Type: text/html; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Description: HTML
First, are you sure you are getting autovacuum to run hourly? = Autovacuum will only vacuum when certain configuration thresholds are = reached. You can set it to only check for those thresholds every so often, = but no vacuuming or analyzing will be done unless they are hit, regardless = of how often autovacuum checks the tables. Whenever you are dealing with = time series, the default thresholds are often insufficient, = especially when you are especially interested in the last few = records on a large table. 
 
What are your autovacuum configuration parameters?
When were the two tables last autovacuum and analyzed, according to = pg_stat_user_tables?
Could you post the output of explain analyze of your query?
Wh= ich default statistic collection parameters do you use? Have you changed = them specifically for the tables you are using?
Which version of Postgres are you running? Which OS?
 
 

>>> venu madhav <venutaurus539@gmail.com> 05/11/10 = 3:47 AM >>>
Hi all,
In my database application, I've a = table whose records can reach 10M and insertions can happen at a faster = rate like 100 insertions per second in the peak times. I configured = postgres to do auto vacuum on hourly basis. I have frontend GUI application= in CGI which displays the data from the database. When I try to get the = last twenty records from the database, it takes around 10-15 mins to = complete the operation.This is the query which is used:

select = e.cid, timestamp, s.sig_class, s.sig_priority, s.sig_name, e.sniff_ip, = e.sniff_channel, s.sig_config, e.wifi_addr_1,
e.wifi_addr_2, e.view_stat= us, bssid FROM event e, signature s WHERE s.sig_id =3D e.signature AND = e.timestamp >=3D '1270449180' AND e.timestamp < '1273473180' ORDER = BY e.cid DESC, e.cid DESC limit 21 offset 10539780;

Can any one = suggest me a better solution to improve the performance.

Please let = me know if you've any further queries.


Thank you,
Venu
--=__Part705ADF6A.1__=--