Re: Selecting a constant question - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Selecting a constant question
Date
Msg-id 20388.1181590938@sss.pgh.pa.us
Whole thread Raw
In response to Selecting a constant question  ("Dann Corbit" <DCorbit@connx.com>)
Responses Re: Selecting a constant question  (Gregory Stark <stark@enterprisedb.com>)
List pgsql-hackers
"Dann Corbit" <DCorbit@connx.com> writes:
> SELECT 1  FROM test.dbo.a_003
> gets about 60,000 records per second
> SELECT '1'  FROM test.dbo.a_003
> gets about 600 records per second.

> The cause is that postgres describes the return column as "unknown"
> length 65534 in the 2nd case.

Postgres describes it in no such fashion --- unknown will always have a
typmod of -1 which means "unspecified".  Possibly you have some client
code that knows much less than it thinks it does about the meanings of
typmod values?

The actual volume of data transmitted is going to be just about the same
either way, so I'm not sure you've diagnosed the cause of slowdown
correctly.  Trying the example in psql seems to be about the same speed
both ways, with if anything a slight advantage to select '1'.
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Dann Corbit"
Date:
Subject: Selecting a constant question
Next
From: Gregory Stark
Date:
Subject: Re: Selecting a constant question