Re: [PERFORM] Too much blocks read

2009-11-18 Thread A. Kretschmer
In response to Waldomiro : > I?m thinking It hapens because in the 7 millions tables, the same 8k > block has diferent records with different keys, so only a few records > with 'my_key' is retrieved when I read a 8k block. > In the part_table, all records stored in a 8k block have 'my_key', so >

Re: [PERFORM] Too much blocks read

2009-11-18 Thread Craig James
Waldomiro wrote: ... I´m thinking It hapens because in the 7 millions tables, the same 8k block has diferent records with different keys, so only a few records with 'my_key' is retrieved when I read a 8k block. In the part_table, all records stored in a 8k block have 'my_key', so It´s much opt

Re: [PERFORM] Too much blocks read

2009-11-18 Thread Matthew Wakeling
On Wed, 18 Nov 2009, Waldomiro wrote: So, I need to retrieve only the last value for some key. That key has about 20.000 tuples in this table. SELECT field1 FROM table_7milions WHERE field1 = 'my_key' ORDER BY field1 DESC LIMIT 1 What's the point of this query? You are forcing Postgresql to r

[PERFORM] Too much blocks read

2009-11-18 Thread Waldomiro
Hello everbody, I´m doing some tests with a large table about 7 milions tuples. So, I need to retrieve only the last value for some key. That key has about 20.000 tuples in this table. SELECT field1 FROM table_7milions WHERE field1 = 'my_key' ORDER BY field1 DESC LIMIT 1 The statistics table