Re: [PERFORM] MYSQL Stats

2016-10-03 Thread Gavin Flower
On 01/10/16 01:03, Joe Proietti wrote: Hi, I am relatively new to MYSQL and not really sure I am in the right forum for this. [...] If your data is important to you, then PostgreSQL is safer! I've used both MySQL & PostgreSQL, and that latter is easier to use. Cheers, Gavin -- Sent vi

Re: [PERFORM] Understanding BRIN index performance

2016-10-03 Thread Ivan Voras
On 3 October 2016 at 12:05, Simon Riggs wrote: > On 3 October 2016 at 10:58, Ivan Voras wrote: > > > I get that, my question was more about why the index scan returned 25 mil > > rows, when the pages are sequentially filled by timestamps? In my > > understading of BRIN, it should have returned a

Re: [PERFORM] Understanding BRIN index performance

2016-10-03 Thread Simon Riggs
On 3 October 2016 at 10:58, Ivan Voras wrote: > I get that, my question was more about why the index scan returned 25 mil > rows, when the pages are sequentially filled by timestamps? In my > understading of BRIN, it should have returned a small number of pages which > would have been filtered (a

Re: [PERFORM] Understanding BRIN index performance

2016-10-03 Thread Ivan Voras
On 3 October 2016 at 11:40, Simon Riggs wrote: > On 3 October 2016 at 10:00, Ivan Voras wrote: > > > My first idea is to create a default BRIN index on dateAdded since the > above > > query is not run frequently. To my surprise, the planner refused to use > the > > index and used sequential sc

Re: [PERFORM] Understanding BRIN index performance

2016-10-03 Thread Simon Riggs
On 3 October 2016 at 10:00, Ivan Voras wrote: > Hi, > > I have a table of around 20 G, more than 220 million records, and I'm > running this query on it: > > explain analyze SELECT MAX(id) - (SELECT id FROM expl_transactions WHERE > dateAdded < (now() - INTERVAL '10 MINUTES') ORDER BY dateAdded DE

Re: [PERFORM] Understanding BRIN index performance

2016-10-03 Thread Madusudanan.B.N
I don't think a BRIN index would help in either case. BRIN just marks each page with a max and min boundaries which are helpful in where clauses and has nothing to do with ordering. For the first operation i.e Max a btree index would do an index scan backward which is just an index lookup in reve

[PERFORM] Understanding BRIN index performance

2016-10-03 Thread Ivan Voras
Hi, I have a table of around 20 G, more than 220 million records, and I'm running this query on it: explain analyze SELECT MAX(id) - (SELECT id FROM expl_transactions WHERE dateAdded < (now() - INTERVAL '10 MINUTES') ORDER BY dateAdded DESC LIMIT 1) FROM expl_transactions; "id" is SERIAL, "dateA