Re: [PERFORM] 57 minute SELECT

2013-10-02 Thread Samuel Stearns
Thanks, Claudio. I'll have a look at the clustering. We have also noticed that the same query with a datetime range of 3 hours (rather than 4 months) runs in just 30 seconds: AND datetime <= '2013-10-03 10:03:49' AND datetime >= '2013-10-03 07:03:49' -Original Message- From: Claudio F

Re: [PERFORM] 57 minute SELECT

2013-10-02 Thread Claudio Freire
On Wed, Oct 2, 2013 at 10:47 PM, Samuel Stearns wrote: > Thanks, Claudio: > > http://explain.depesz.com/s/WJQx If you have a test database, and if it doesn't hurt other queries of course, try clustering on the ip index. I believe your problem is that the index isn't helping much, it's probably h

Re: [PERFORM] 57 minute SELECT

2013-10-02 Thread Samuel Stearns
Thanks, David. Can't run EXPLAIN (ANALYZE, BUFFERS) as I'm on 8.4. -Original Message- From: pgsql-performance-ow...@postgresql.org [mailto:pgsql-performance-ow...@postgresql.org] On Behalf Of David Johnston Sent: Thursday, 3 October 2013 11:19 AM To: pgsql-performance@postgresql.org Sub

Re: [PERFORM] 57 minute SELECT

2013-10-02 Thread David Johnston
Samuel Stearns-2 wrote > EXPLAIN: > > QUERY PLAN > > ---

Re: [PERFORM] 57 minute SELECT

2013-10-02 Thread Samuel Stearns
Thanks, Claudio: http://explain.depesz.com/s/WJQx -Original Message- From: Claudio Freire [mailto:klaussfre...@gmail.com] Sent: Thursday, 3 October 2013 11:16 AM To: Samuel Stearns Cc: David Johnston; pgsql-performance@postgresql.org Subject: Re: [PERFORM] 57 minute SELECT On Wed, Oct

Re: [PERFORM] 57 minute SELECT

2013-10-02 Thread Claudio Freire
On Wed, Oct 2, 2013 at 10:17 PM, Samuel Stearns wrote: > The last part, the EXPLAIN, is too big to send. Is there an alternative way > I can get it too you, other than chopping it up and sending in multiple > parts? Try explain.depesz.com On Wed, Oct 2, 2013 at 10:30 PM, Samuel Stearns wrote

Re: [PERFORM] 57 minute SELECT

2013-10-02 Thread Samuel Stearns
zone)) -> Bitmap Index Scan on syslog_master_ip_idx (cost=0.00..4.27 rows=2 width=0) (actual time=0.019..0.019 rows=0 loops=1) Index Cond: (public.syslog_master.ip = public.devices.ip) -> Bitmap Heap Scan on syslog_201307 syslog_ma

Re: [PERFORM] 57 minute SELECT

2013-10-02 Thread Samuel Stearns
Total RAM = 1G is correct This query executes as the result of a search from our Network Management System Device Audit web tool where the date range is large and is focused on a specific device. I was thinking it should execute more quickly since syslog.ip has an index and we're not performin

Re: [PERFORM] 57 minute SELECT

2013-10-02 Thread Samuel Stearns
The last part, the EXPLAIN, is too big to send. Is there an alternative way I can get it too you, other than chopping it up and sending in multiple parts? Thank you, Sam From: Samuel Stearns Sent: Thursday, 3 October 2013 10:34 AM To: Samuel Stearns; pgsql-performance@postgresql.org Subject:

Re: [PERFORM] 57 minute SELECT

2013-10-02 Thread David Johnston
Samuel Stearns-2 wrote > Total RAM - 1G > > > 1. Explain on SELECT. So either this is a typo (1 GB of RAM) or your query is likely ending up I/O bound. You should probably provide EXPLAIN and EXPLAIN (ANALYZE) output since even with the schema it is impossible for someone to see what the

Re: [PERFORM] 57 minute SELECT

2013-10-02 Thread Samuel Stearns
Ok, let's try 3 parts: Table counts: syslog - 150200285 devices - 3291 mongroups - 71 The query: SELECT syslog.ip, syslog.msg, syslog.datetime, devices.hostname, devices.hostpop FROM syslog, devices WHERE syslog.ip IN (SELECT ip FROM devices,

[PERFORM] 57 minute SELECT

2013-10-02 Thread Samuel Stearns
Howdy, I'm going to post this in 2 parts as I think it's too big for 1 post. Environment: PG 8.4.17 Linux Ubuntu 10.04 Total RAM - 1G Things that have been performed: 1. Explain on SELECT. 2. ANALYZE database. 3. VACUUM database. 4. shared_buffers = 256M 5. e

[PERFORM] Re: [GENERAL] Help on ṕerformance

2013-10-02 Thread Carlos Eduardo Sotelo Pinto
Thanks to all I have fix that refactoring the function BEGIN arr := regexp_split_to_array(_imeis, E'\\s+'); RETURN QUERY SELECT gpstracking_device_tracks.imei, gpstracking_device_tracks.device_id, gpstracking_device_tracks.date_time_process, gpstracking_device_tracks.latitude, gpstracking_de

[PERFORM] Re: [GENERAL] Help on ṕerformance

2013-10-02 Thread Merlin Moncure
On Mon, Sep 30, 2013 at 10:03 AM, Carlos Eduardo Sotelo Pinto wrote: > > I need a help on postgresql performance > > I have configurate my postgresql files for tunning my server, however it is > slow and cpu resources are highter than 120% > > I have no idea on how to solve this issue, I was tryin