pg.ddx.io pgsql-performance@postgresql.org mailing list archive
help / color / mirror / Atom feedDiscovering the most searched values for a field
3+ messages / 2 participants
[nested] [flat]
* Discovering the most searched values for a field
@ 2012-01-13 18:08 alexandre - aldeia digital <adaldeia@gmail.com>
2012-01-13 19:08 ` Re: Discovering the most searched values for a field Josh Berkus <josh@agliodbs.com>
0 siblings, 1 reply; 3+ messages in thread
From: alexandre - aldeia digital @ 2012-01-13 18:08 UTC (permalink / raw)
To: pgsql-performance
Hi,
Is there a simple way (or a tool) to discover the most searched values
in a field from a table ?
In the pg_stats, I can see the most common values generated by ANALYZE,
but I want to know how many queries are using this values. With this
information and the other statistics, I want to create partial indexes
or use table partitioning to create some benchmarks to speed up the
database access.
Best regards.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Discovering the most searched values for a field
2012-01-13 18:08 Discovering the most searched values for a field alexandre - aldeia digital <adaldeia@gmail.com>
@ 2012-01-13 19:08 ` Josh Berkus <josh@agliodbs.com>
2012-01-23 17:26 ` Re: Discovering the most searched values for a field alexandre - aldeia digital <adaldeia@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Josh Berkus @ 2012-01-13 19:08 UTC (permalink / raw)
To: pgsql-performance
On 1/13/12 10:08 AM, alexandre - aldeia digital wrote:
> Hi,
>
> Is there a simple way (or a tool) to discover the most searched values
> in a field from a table ?
>
> In the pg_stats, I can see the most common values generated by ANALYZE,
> but I want to know how many queries are using this values. With this
> information and the other statistics, I want to create partial indexes
> or use table partitioning to create some benchmarks to speed up the
> database access.
No simple + fast way.
The way to do this is:
1) log all queries
2) load query log into a database
3) filter to queries which only run against that table
4) analyze queries for values against that column.
For (4), we've had the best luck with generating explain plans in XML
and then digesting the XML to look for filter conditions. Finding
column matches by regex was a lot less successful.
--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Discovering the most searched values for a field
2012-01-13 18:08 Discovering the most searched values for a field alexandre - aldeia digital <adaldeia@gmail.com>
2012-01-13 19:08 ` Re: Discovering the most searched values for a field Josh Berkus <josh@agliodbs.com>
@ 2012-01-23 17:26 ` alexandre - aldeia digital <adaldeia@gmail.com>
0 siblings, 0 replies; 3+ messages in thread
From: alexandre - aldeia digital @ 2012-01-23 17:26 UTC (permalink / raw)
To: pgsql-performance
Em 13-01-2012 17:08, Josh Berkus escreveu:
> On 1/13/12 10:08 AM, alexandre - aldeia digital wrote:
>> Hi,
>>
>> Is there a simple way (or a tool) to discover the most searched values
>> in a field from a table ?
>>
>> In the pg_stats, I can see the most common values generated by ANALYZE,
>> but I want to know how many queries are using this values. With this
>> information and the other statistics, I want to create partial indexes
>> or use table partitioning to create some benchmarks to speed up the
>> database access.
>
> No simple + fast way.
>
> The way to do this is:
>
> 1) log all queries
> 2) load query log into a database
> 3) filter to queries which only run against that table
> 4) analyze queries for values against that column.
>
> For (4), we've had the best luck with generating explain plans in XML
> and then digesting the XML to look for filter conditions. Finding
> column matches by regex was a lot less successful.
>
Thanks Josh ! I will try this. The only problem is the size of the LOGs.
One day with logs turned on generates 100 GB log file in the most of my
customers...
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2012-01-23 17:26 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-01-13 18:08 Discovering the most searched values for a field alexandre - aldeia digital <adaldeia@gmail.com>
2012-01-13 19:08 ` Josh Berkus <josh@agliodbs.com>
2012-01-23 17:26 ` alexandre - aldeia digital <adaldeia@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox