Re: count(*) performance improvement ideas - Mailing list pgsql-hackers

From Stephen Denne
Subject Re: count(*) performance improvement ideas
Date
Msg-id F0238EBA67824444BC1CB4700960CB48036E82A4@dmpeints002.isotach.com
Whole thread Raw
In response to Re: count(*) performance improvement ideas  ("Stephen Denne" <Stephen.Denne@datamail.co.nz>)
Responses Re: count(*) performance improvement ideas  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
<div dir="ltr" id="idOWAReplyText1271"><div dir="ltr"><font color="#000000" face="Arial" size="2">(apologies for the
emailformat & top posting, I've had to temporarily switch to using a web interface from home that doesn't seem to
knowwhat plain text is)</font></div><div dir="ltr"><font face="Arial" size="2"></font> </div><div dir="ltr"><font
face="Arial"size="2">pg_settings view doesn't contain custom variables created on the fly, (nor, from memory, ones
definedin postgresql.conf. I'm not able to check and confirm that at the moment).</font></div><div dir="ltr"><font
face="Arial"size="2">Fixing that would satisfy 2 & 3 nicely.</font></div><div dir="ltr"><font face="Arial"
size="2">Thedocs on them say the ones in postgresql.conf are to be used by modules when they initialize, as the values
touse when setting up actual real server variables, (able to store more types than just text), which I presume would
appearin pg_settings.</font></div><div dir="ltr"><font face="Arial" size="2"></font> </div><div dir="ltr"><font
face="Arial"size="2">Updating existing variables is much quicker, over 100000 updates per second.</font></div><div
dir="ltr"><fontface="Arial" size="2"></font> </div><div dir="ltr"><font face="Arial" size="2">Regards,</font></div><div
dir="ltr"><fontface="Arial" size="2">Stephen Denne.</font></div></div><div dir="ltr"><br /></div><div dir="ltr"><hr
tabindex="-1"/></div><div dir="ltr"><font face="Tahoma" size="2"><b>From:</b> Tom Lane [mailto:tgl@sss.pgh.pa.us]<br
/><b>Sent:</b>Wed 16/04/2008 1:55 p.m.<br /></font><font size="2"></font></div><div dir="ltr"><font size="2">"Stephen
Denne"<Stephen.Denne@datamail.co.nz> writes:<br />> The custom variable class can also be used to aggregate
thedeltas within a transaction, though there are some minor difficulties:<br /><br />> 1) They only store text<br
/>>2) You can only find out that a value has not been set by catching an exception<br />> 3) There is no way to
listthe settings.<br /><br />As for 2) and 3), can't you look into the pg_settings view?<br /><br />> The time to
createthem for the first time for a connection seems to<br />vary a bit, between 200 and 1000 per minute.<br /><br
/>Yeah,that path is not optimized at all because it was never considered<br />performance-critical.  Updating an
existingvariable should be cheaper.<br /><br />                        regards, tom lane<br /></font></div><pre> 
Disclaimer:
At the Datamail Group we value team commitment, respect, achievement, customer focus, and courage. This email with any
attachmentsis confidential and may be subject to legal privilege.  If it is not intended for you please advise by reply
immediately,destroy it and do not copy, disclose or use it in any way. 
__________________________________________________________________ This email has been scanned by the DMZGlobal
BusinessQuality             Electronic Messaging Suite. 
Please see http://www.dmzglobal.com/dmzmessaging.htm for details.
__________________________________________________________________

</pre>

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: count(*) performance improvement ideas
Next
From: Tom Lane
Date:
Subject: Re: count(*) performance improvement ideas