Re: Measuring CPU time use? (Another stupid question) - Mailing list pgsql-general
From | Jessica Blank |
---|---|
Subject | Re: Measuring CPU time use? (Another stupid question) |
Date | |
Msg-id | Pine.LNX.4.44.0212181352520.392-100000@ensim.rackshack.net Whole thread Raw |
In response to | Re: Measuring CPU time use? (Another stupid question) ("scott.marlowe" <scott.marlowe@ihs.com>) |
Responses |
Re: Measuring CPU time use? (Another stupid question)
Re: Measuring CPU time use? (Another stupid question) |
List | pgsql-general |
I suppose I should rephrase. I am trying to figure out which of two competing ideas of mine is the more efficient. Right now, I am running it on a "slow" machine-- a G3/220 with 148MB of RAM, on OLD SCSI-1/2 hardware. Modern machines have much faster CPUs-- they also have much faster disk tho. What is important is how long it takes to do a "typical" or "average" search. I am coding a full-text search system and had two ideas on how to do it (without implementing my own file-based database, using another person's, writing stuff in C, or other stuff far more complex than what the client is paying me for ;) ) So I guess what I'm saying is that I don't care so much about CPU time, or I/O time, but *TOTAL* time. How long it takes from the instant the query hits Postgres to the instant I get my results back... So I need a way to run some 'typical' queries (common search terms for this system) and figure out which of my algorithms works better... :) On Wed, 18 Dec 2002, scott.marlowe wrote: > But you realize that the time it took to run the query is NOT the same as > the CPU time, right? A heavy table with 100,000,000 rows may use only a > tiny percentage of CPU but take a minute to return, while your I/O > subsystem thrashes away dmaing the data into memory where it gets copied > to output in 30 milliseconds of CPU time. > > Look for iostat to analyze your I/O load, which is often the greater load > factor for a db server than CPU use. > > On Wed, 18 Dec 2002, Jessica Blank wrote: > > > Thanky thanky. That might work. > > > > Still, I'd rather just have a way I could get a plain old figure. > > > > E.g.: > > > > DELETE FROM V$CPUUSE; > > (DO THE QUERIES IN QUESTION HERE) > > SELECT NANOSECONDS_USED FROM V$CPUUSE; > > > > On Wed, 18 Dec 2002, Joe Conway wrote: > > > > > Jessica Blank wrote: > > > > I wish to find a way to measure the CPU time used by any given query (or > > > > set of queries). > > > > > > > > I could not find any information on how to do this... > > > > > > > > Is there some secret internal table (like the V$ virtual tables in Oracle) > > > > that contains this info? > > > > > > Well, I don't know of anything specific to CPU usage, but for monitoring your > > > server see Monitoring Database Activity in the manual: > > > http://www.us.postgresql.org/users-lounge/docs/7.3/postgres/monitoring.html > > > > > > Also, one of the best and most commonly used tools for optimizing individual > > > queries is EXPLAIN ANALYZE; see: > > > http://www.us.postgresql.org/users-lounge/docs/7.3/postgres/sql-explain.html > > > > > > HTH, > > > > > > Joe > > > > > > > > -- J e s s i c a L e a h B l a n k
pgsql-general by date: