Re: significant slow down with various LIMIT

From: Kevin Grittner
Subject: Re: significant slow down with various LIMIT
Date: ,
Msg-id: 4BC58B75020000250003085F@gw.wicourts.gov
(view: Whole thread, Raw)
In response to: Re: significant slow down with various LIMIT  ("Kevin Grittner")
List: pgsql-performance

Tree view

significant slow down with various LIMIT  (Helio Campos Mello de Andrade, )
 Re: significant slow down with various LIMIT  ("Kevin Grittner", )
  Re: significant slow down with various LIMIT  (norn, )
   Re: significant slow down with various LIMIT  ("Kevin Grittner", )
  Re: significant slow down with various LIMIT  (norn, )
   Re: significant slow down with various LIMIT  ("Kevin Grittner", )
    Re: significant slow down with various LIMIT  (Chris Bowlby, )
    Re: significant slow down with various LIMIT  ("Kevin Grittner", )
  Re: significant slow down with various LIMIT  (norn, )
   Re: significant slow down with various LIMIT  ("Kevin Grittner", )
    Re: significant slow down with various LIMIT  ("Kevin Grittner", )
  Re: significant slow down with various LIMIT  (norn, )
  Re: significant slow down with various LIMIT  (norn, )

"Kevin Grittner" <> wrote:

> (3) Try it like this (untested, so you may need to fix it up):
>
> explain analyze
> SELECT core_object.id
>   from (SELECT id, city_id FROM "plugins_guide_address")
>        "plugins_guide_address"
>   JOIN "plugins_plugin_addr"
>     ON ("plugins_plugin_addr"."address_id"
>        = "plugins_guide_address"."id")
>   JOIN "core_object"
>     ON ("core_object"."id" = "plugins_plugin_addr"."oid_id")
>   WHERE "plugins_guide_address"."city_id" = 4535
>   ORDER BY "core_object"."id" DESC
>   LIMIT 4 -- or whatever it normally takes to cause the problem
> ;

Hmph.  I see I didn't take that quite where I intended.
Forget the above and try this:

explain analyze
SELECT core_object.id
  from (SELECT id, city_id FROM "plugins_guide_address"
          WHERE "city_id" = 4535) "plugins_guide_address"
  JOIN "plugins_plugin_addr"
    ON ("plugins_plugin_addr"."address_id"
       = "plugins_guide_address"."id")
  JOIN "core_object"
    ON ("core_object"."id" = "plugins_plugin_addr"."oid_id")
  ORDER BY "core_object"."id" DESC
  LIMIT 4 -- or whatever it normally takes to cause the problem
;

-Kevin


pgsql-performance by date:

From: Krzysztof Kardas
Date:
Subject: Re: PostgreSQL with Zabbix - problem of newbe
From: Dave Crooke
Date:
Subject: JDBC question for PG 8.3.9