Re: [PERFORM] query not using GIN index

2015-08-21 Thread Tomas Vondra
Hi, On 08/22/2015 03:55 AM, Guo, Yun wrote: Hi, We have a query on a column with GIN index, but query plan chooses not using the index but do an seq scan whichi is must slower CREATE INDEX idx_access_grants_on_access_tokens ON access_grants USING gin (access_tokens); explain analyze SELECT "a

[PERFORM] query not using GIN index

2015-08-21 Thread Guo, Yun
Hi, We have a query on a column with GIN index, but query plan chooses not using the index but do an seq scan whichi is must slower CREATE INDEX idx_access_grants_on_access_tokens ON access_grants USING gin (access_tokens); explain analyze SELECT "access_grants".* FROM "access_grants" WHERE

Re: [PERFORM] Performance bottleneck due to array manipulation

2015-08-21 Thread Igor Neyman
From: pgsql-performance-ow...@postgresql.org [mailto:pgsql-performance-ow...@postgresql.org] On Behalf Of Genc, Ömer Sent: Friday, August 21, 2015 8:49 AM To: pgsql-performance@postgresql.org Subject: [PERFORM] Performance bottleneck due to array manipulation Hey, i have a very long running st

Re: [PERFORM] Performance bottleneck due to array manipulation

2015-08-21 Thread Félix GERZAGUET
Hello, On Fri, Aug 21, 2015 at 2:48 PM, Genc, Ömer wrote: > Now I want to delete all entries from ims_point, where the timestamp is > older than one hour. The currently being referenced ids of the table > ims_object_header should be excluded from this deletion. > > > delete from public.ims_poin

Re: [PERFORM] Performance bottleneck due to array manipulation

2015-08-21 Thread Tom Lane
=?iso-8859-1?Q?Genc=2C_=D6mer?= writes: > i have a very long running stored procedure, due to array manipulation in a > stored procedure. The following procedure takes 13 seconds to finish. > BEGIN > point_ids_older_than_one_hour := '{}'; > object_ids_to_be_invalidated := '{}'; > se

[PERFORM] Performance bottleneck due to array manipulation

2015-08-21 Thread Genc , Ömer
Hey, i have a very long running stored procedure, due to array manipulation in a stored procedure. The following procedure takes 13 seconds to finish. BEGIN point_ids_older_than_one_hour := '{}'; object_ids_to_be_invalidated := '{}'; select ARRAY(SELECT point_id

Re: [PERFORM] Most efficient way of querying M 'related' tables where N out of M may contain the key

2015-08-21 Thread David G. Johnston
On Fri, Aug 21, 2015 at 8:07 AM, Stephane Bailliez wrote: > > On Thu, Aug 20, 2015 at 8:19 PM, David G. Johnston < > david.g.johns...@gmail.com> wrote: > >> >> ​SELECT [...] >> FROM (SELECT reference_id, [...] FROM table_where_referenced_id_is_a_pk >> WHERE reference_id EXISTS/IN/JOIN)​ >> >> ​sr

Re: [PERFORM] Most efficient way of querying M 'related' tables where N out of M may contain the key

2015-08-21 Thread Stephane Bailliez
On Thu, Aug 20, 2015 at 8:19 PM, David G. Johnston < david.g.johns...@gmail.com> wrote: > > ​SELECT [...] > FROM (SELECT reference_id, [...] FROM table_where_referenced_id_is_a_pk > WHERE reference_id EXISTS/IN/JOIN)​ > > ​src > ​LEFT JOIN type1 USING (reference_id) > LEFT JOIN type2 USING (refere