[GENERAL] Slow Query - PostgreSQL 9.2

2016-01-10 Thread Saulo Merlo
I've got a slow query.. I'd like to make it faster.. Make add an index? Query: SELECT j.clientid AS client_id, ni.segment_index AS note_id, f.inode_id AS file_id, f.node_full_path AS filename, f.last_changed AS date_created, f.file_data AS main_binary, medi

Re: [GENERAL] Slow Query - PostgreSQL 9.2

2016-01-10 Thread Saulo Merlo
016 21:23:01 -0800 > Subject: Re: [GENERAL] Slow Query - PostgreSQL 9.2 > From: vitaly.buro...@gmail.com > To: smerl...@outlook.com > CC: pgsql-general@postgresql.org > > On 1/10/16, Vitaly Burovoy wrote: > > On 1/10/16, Saulo Merlo wrote: > >> I've got a slo

Re: [GENERAL] Slow Query - PostgreSQL 9.2

2016-01-10 Thread Saulo Merlo
t; To: smerl...@outlook.com > CC: pgsql-general@postgresql.org > > On 1/10/16, Saulo Merlo wrote: > > Hi Vitaly, > > > > Yep... gorfs.nodes is a view. > > And the schema is: gorfs.inode_segments > > So... CREATE INDEX index_name ON gorfs.inode_segments(st_ctime

Re: [GENERAL] Slow Query - PostgreSQL 9.2

2016-01-10 Thread Saulo Merlo
ta_length", "t"."st_atime" AS "last_accessed", "t"."st_mtime" AS "last_modified", "t"."st_ctime" AS "last_changed", "t"."checksum_md5", ("mst"."media_type"

Re: [GENERAL] Slow Query - PostgreSQL 9.2

2016-01-10 Thread Saulo Merlo
;."st_ino_target")::bigint) AND (("segment_index")::"text" = 'thumbnail.with_name'::"text"))"" -> Index Scan using "ix_inode_segments_st_inos" on "inode_segments&quo

Re: [GENERAL] Slow Query - PostgreSQL 9.2

2016-01-11 Thread Saulo Merlo
Thanks Vitaly for all your help. I'll have a very deep look on the links you have provided. In the meantime, I'll also post here what I need.. IF you could help one more time, would be very very nice. Thank you again. This can either be nfs_file_path or nfs_migration_date (both new columns). Ad

Re: [GENERAL] Slow Query - PostgreSQL 9.2

2016-01-12 Thread Saulo Merlo
UPDATED: Index created:create index concurrently inode_segments_st_ino_target_pidx on gorfs.inode_segments (st_ino desc, st_ino_target desc) where nfs_migration_date is null; NEW EXPLAIN ANALYZE:http://explain.depesz.com/s/Swu I also am able to create a temporary table to store migrations, which

[GENERAL] Query Questions - PostgreSQL

2016-01-12 Thread Saulo Merlo
So.. I have a Query that is taking too long to complete. OLD QUERY: SELECT file.inode_idAS file_id, file.parent_inode_id AS file_group, file.relative_path AS file_type, file.file_data AS file_binary, file.node_full_path AS file_name, file.last_modified AS date_createdFR

Re: [GENERAL] Query Questions - PostgreSQL

2016-01-13 Thread Saulo Merlo
Anyone who can help with this please? Thanks Sent from my phone > On 13/01/2016, at 3:30 PM, Saulo Merlo wrote: > > So.. I have a Query that is taking too long to complete. > > OLD QUERY: > >> SELECT > >> file.inode_idAS file_id, > >

Re: [GENERAL] Query Questions - PostgreSQL

2016-01-14 Thread Saulo Merlo
On 13/01/2016, at 3:30 PM, Saulo Merlo wrote: So.. I have a Query that is taking too long to complete. OLD QUERY: SELECT file.inode_idAS file_id, file.parent_inode_id AS file_group, file.relative_path AS file_type, file.file_data AS file_binary, file.node_full_path