From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Timing of 'SELECT 1' |
Date: | 2004-03-10 16:42:12 |
Message-ID: | 200403101642.i2AGgCF16068@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > I am timing small queries, and found that a PREPARE/EXECUTE of "SELECT
> > 1" takes about 1.2ms on my machine. A normal SELECT doesn't take much
> > longer, so I am wondering why a simpler query isn't faster.
>
> Define "normal SELECT". I can think of plenty of people who would be
> overjoyed if their average SELECT was only a couple millisecs.
OK, you asked, so here it is. I define a simple select as pulling a
single column from a single table using uniquely indexed key. It takes
1.182 ms on my machine, almost the same time as SELECT 1.
This tells me that the actual table access isn't the issue, it is the
overhead of the query processing itself. What I want to find out is
where that 1ms is coming from, because it isn't coming from the
executor. What I might do is to add ResetUsage/ShowUsage calls around
the other parts of the query loop to find who is using the time.
I am using log_duration, so this isn't measuring network time, just time
in the backend (at least I think so).
Run the attached script through psql and you will see the times.
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
Attachment | Content-Type | Size |
---|---|---|
unknown_filename | text/plain | 3.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2004-03-10 16:42:57 | Re: Timing of 'SELECT 1' |
Previous Message | Neil Conway | 2004-03-10 16:39:57 | Re: Timing of 'SELECT 1' |