[GENERAL] Optimise OR condiditions across multiple joins

2016-06-08 Thread Andrew Beverley
Dear all, Is there a way to efficiently perform OR conditions across multiple joins? For example, I have the following statement: SELECT RECORD.id FROM RECORD left join string ON string.record_id = RECORD.id AND string.layout_id = 6 left join DATE

Re: [GENERAL] Actual rows significantly more than estimated during many joins

2016-06-04 Thread Andrew Beverley
On Sat, 4 Jun 2016 Andrew Beverley wrote: > I'm performing a query with many joins, with a WHERE condition on the > "root" table. As far as I am aware, each join is indexed, as is the > WHERE clause. To my simple mind, this is just a case of taking a set > of condition

Re: [GENERAL] Actual rows significantly more than estimated during many joins

2016-06-04 Thread Andrew Beverley
On Sat, 4 Jun 2016 Andrew Beverley wrote: > When I run EXPLAIN ANALYZE, I see that the actual query is scanning > significantly more rows for the join than was estimated. There is also > a huge number of loops for the joins. Why is this, and is there an > easy fix? I should have said

[GENERAL] Actual rows significantly more than estimated during many joins

2016-06-04 Thread Andrew Beverley
Dear all, I'm performing a query with many joins, with a WHERE condition on the "root" table. As far as I am aware, each join is indexed, as is the WHERE clause. To my simple mind, this is just a case of taking a set of conditional indexed values, and then "adding on" the relevant indexed data. W

Re: [GENERAL] Creating a user for pg_start_backup

2015-07-21 Thread Andrew Beverley
On Tue, 2015-07-21 at 03:00 -0700, John R Pierce wrote: > On 7/21/2015 1:51 AM, Andrew Beverley wrote: > > Thanks John. The backup script is running as root, so presumably I'd have > > to > > use > > sudo? Or should I run a separate cron job as postgres to do

Re: [GENERAL] Creating a user for pg_start_backup

2015-07-21 Thread Andrew Beverley
On Tue, 2015-07-21 at 01:46 -0700, John R Pierce wrote: > On 7/21/2015 1:31 AM, Andrew Beverley wrote: > > I had to specify a database name when connecting: > > > > psql -U backup -c "select pg_start_backup('Daily backup')" -d postgres > >

Re: [GENERAL] Creating a user for pg_start_backup

2015-07-21 Thread Andrew Beverley
On Tue, 2015-07-21 at 16:54 +0900, Michael Paquier wrote: > On Tue, Jul 21, 2015 at 4:47 PM, Andrew Beverley wrote: > > Dear all, > > > > I'm setting up hot backups on my database server. As such, I'd like to set > > up a > > Postgres user

[GENERAL] Creating a user for pg_start_backup

2015-07-21 Thread Andrew Beverley
Dear all, I'm setting up hot backups on my database server. As such, I'd like to set up a Postgres user that has access to only pg_start_backup and pg_stop_backup. I'm unable to work out how to do this with the various GRANT options. Can someone point me in the right direction please? Or is ther