Re: Performance question 83 GB Table 150 million rows, distinct select

Поиск
Список
Период
Сортировка
От Andy Colson
Тема Re: Performance question 83 GB Table 150 million rows, distinct select
Дата
Msg-id 4EC46D46.5050608@squeakycode.net
обсуждение исходный текст
Ответ на Performance question 83 GB Table 150 million rows, distinct select  (Tory M Blue <tmblue@gmail.com>)
Список pgsql-performance
On 11/16/2011 04:53 PM, Tory M Blue wrote:
> Linux F12 64bit
> Postgres 8.4.4
> 16 proc / 32GB
> 8 disk 15KRPM SAS/Raid 5 (I know!)
>
>
> shared_buffers = 6000MB
> #temp_buffers = 8MB
> max_prepared_transactions = 0
> work_mem = 250MB
> maintenance_work_mem = 1000MB
>
>
>
>
>
> We now have about 180mill records in that table. The database size is
> about 580GB and the userstats table which is the biggest one and the
> one we query the most is 83GB.
>
> Just a basic query takes 4 minutes:
>
> For e.g. select count(distinct uid) from userstats where log_date>'11/7/2011'
>

How'd you feel about keeping a monthly summary table?  Update it daily, with only a days worth of stats, then you could
querythe summary table much faster. 

That's what I do for my website stats.  I log details for a month, then summarize everything into a summary table, and
blowaway the details.  You wouldn't have to delete the details if you wanted them, just keeping the summary table
updatedwould be enough. 

-Andy

В списке pgsql-performance по дате отправления:

Предыдущее
От: Scott Marlowe
Дата:
Сообщение: Re: Performance question 83 GB Table 150 million rows, distinct select
Следующее
От: "Tomas Vondra"
Дата:
Сообщение: Re: Performance question 83 GB Table 150 million rows, distinct select