<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
If you've done an ANALYZE recently, this query will return an approx.
answer really fast.<br>
<br>
SELECT reltuples FROM pg_class WHERE relname = 'table1';<br>
<br>
<br>
Matt Doughty wrote:
<blockquote
cite="mid:57CDB5BBD7F4E244BDA8158D9AC227761A0640@sageograma.GEO-I.local"
type="cite">
<meta http-equiv="Content-Type" content="text/html; ">
<meta name="Generator" content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><o:SmartTagType
namespaceuri="urn:schemas-microsoft-com:office:smarttags"
name="metricconverter">
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--a:link
{mso-style-priority:99;}
span.MSOHYPERLINK
{mso-style-priority:99;}
a:visited
{mso-style-priority:99;}
span.MSOHYPERLINKFOLLOWED
{mso-style-priority:99;}
/* Font Definitions */
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:Calibri;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman";}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline;}
span.EstiloCorreo17
{mso-style-type:personal;
font-family:Arial;
color:windowtext;}
span.EstiloCorreo18
{mso-style-type:personal;
font-family:Calibri;
color:#1F497D;}
span.EstiloCorreo19
{mso-style-type:personal-reply;
font-family:Arial;
color:navy;}
@page Section1
{size:595.3pt 841.9pt;
margin:70.85pt 3.0cm 70.85pt 3.0cm;}
div.Section1
{page:Section1;}
-->
</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</o:SmartTagType>
<div class="Section1">
<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
style="font-size: 10pt; font-family: Arial; color: navy;" lang="EN-GB">I’m
trying out a
vacuum at the moment to see if it helps.<o:p></o:p></span></font></p>
<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
style="font-size: 10pt; font-family: Arial; color: navy;" lang="EN-GB"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
style="font-size: 10pt; font-family: Arial; color: navy;" lang="EN-GB"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
style="font-size: 10pt; font-family: Arial; color: navy;" lang="EN-GB"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
style="font-size: 10pt; font-family: Arial; color: navy;" lang="EN-GB">Matt<o:p></o:p></span></font></p>
<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
style="font-size: 10pt; font-family: Arial; color: navy;" lang="EN-GB"><o:p> </o:p></span></font></p>
<div>
<table class="MsoNormalTable"
style="background: white none repeat scroll 0%; width: 100%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"
align="left" bgcolor="white" border="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td colspan="2" style="padding: 0.75pt;">
<p class="MsoNormal" style=""><font color="navy"
face="Times New Roman" size="3"><span
style="font-size: 12pt; color: navy;" lang="EN-GB"> <o:p></o:p></span></font></p>
</td>
</tr>
<tr>
<td colspan="2" style="padding: 0.75pt;">
<p class="MsoNormal" style=""><font color="navy"
face="Times New Roman" size="3"><span
style="font-size: 12pt; color: navy;" lang="EN-GB"> <o:p></o:p></span></font></p>
</td>
</tr>
<tr>
<td style="padding: 0.75pt;">
<p class="MsoNormal" style=""><font color="#2e3a75" face="Arial"
size="3"><span
style="font-size: 12pt; font-family: Arial; color: rgb(46, 58, 117);">Matt
Doughty</span></font><font color="navy"><span style="color: navy;"><o:p></o:p></span></font></p>
</td>
<td rowspan="5" style="padding: 0.75pt;" valign="top">
<p class="MsoNormal" style=""><font color="navy"
face="Times New Roman" size="3"><span
style="font-size: 12pt; color: navy;"><img id="_x0000_i1027"
src="cid:part1.08040604.04010300@refractions.net" height="100"
width="90"><o:p></o:p></span></font></p>
</td>
</tr>
<tr>
<td style="padding: 0.75pt;">
<p class="MsoNormal" style=""><font color="#2e3a75" face="Arial"
size="3"><span
style="font-size: 12pt; font-family: Arial; color: rgb(46, 58, 117);">GEOGRAMA
S.L.</span></font><font color="navy" face="Arial"><span
style="font-family: Arial; color: navy;"><o:p></o:p></span></font></p>
</td>
</tr>
<tr>
<td style="padding: 0.75pt;">
<p class="MsoNormal" style=""><font color="#2e3a75" face="Arial"
size="3"><span
style="font-size: 12pt; font-family: Arial; color: rgb(46, 58, 117);">Tel.:
+34 945 13 13 72 652 77 14 15</span></font><font color="navy"
face="Arial"><span style="font-family: Arial; color: navy;"><o:p></o:p></span></font></p>
</td>
</tr>
<tr>
<td style="padding: 0.75pt;">
<p class="MsoNormal" style=""><font color="#2e3a75" face="Arial"
size="3"><span
style="font-size: 12pt; font-family: Arial; color: rgb(46, 58, 117);">Fax:
+34 945 23 03 40 </span></font><font color="navy" face="Arial"><span
style="font-family: Arial; color: navy;"><o:p></o:p></span></font></p>
</td>
</tr>
<tr>
<td style="padding: 0.75pt;">
<p class="MsoNormal" style=""><font color="#2e3a75" face="Arial"
size="3"><span
style="font-size: 12pt; font-family: Arial; color: rgb(46, 58, 117);"><a class="moz-txt-link-abbreviated" href="http://www.geograma.com">www.geograma.com</a></span></font><font
color="navy" face="Arial"><span
style="font-family: Arial; color: navy;"><o:p></o:p></span></font></p>
</td>
</tr>
<tr>
<td colspan="2" style="padding: 0.75pt;">
<p class="MsoNormal" style=""><font color="navy"
face="Times New Roman" size="3"><span
style="font-size: 12pt; color: navy;"> <o:p></o:p></span></font></p>
</td>
</tr>
</tbody>
</table>
</div>
<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
style="font-size: 10pt; font-family: Arial; color: navy;"><o:p> </o:p></span></font></p>
<div>
<div class="MsoNormal" style="text-align: center;" align="center"><font
face="Times New Roman" size="3"><span style="font-size: 12pt;">
<hr tabindex="-1" align="center" size="2" width="100%"></span></font></div>
<p class="MsoNormal"><b><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma; font-weight: bold;">De:</span></font></b><font
face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;">
<a class="moz-txt-link-abbreviated" href="mailto:postgis-users-bounces@postgis.refractions.net">postgis-users-bounces@postgis.refractions.net</a>
[<a class="moz-txt-link-freetext" href="mailto:postgis-users-bounces@postgis.refractions.net">mailto:postgis-users-bounces@postgis.refractions.net</a>] <b><span
style="font-weight: bold;">En nombre de </span></b>Rob Tester<br>
<b><span style="font-weight: bold;">Enviado el:</span></b> miércoles,
06 de junio
de 2007 17:23<br>
<b><span style="font-weight: bold;">Para:</span></b> 'PostGIS Users
Discussion'<br>
<b><span style="font-weight: bold;">Asunto:</span></b> RE:
[postgis-users] Slow
select from big table</span></font><o:p></o:p></p>
</div>
<p class="MsoNormal"><font face="Times New Roman" size="3"><span
style="font-size: 12pt;"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font color="#1f497d" face="Calibri" size="2"><span
style="font-size: 11pt; font-family: Calibri; color: rgb(31, 73, 125);"
lang="EN-US">Sounds more like a
question for the general group. But, have you run a vacuum analyze on
the
table ?<o:p></o:p></span></font></p>
<p class="MsoNormal"><font color="#1f497d" face="Calibri" size="2"><span
style="font-size: 11pt; font-family: Calibri; color: rgb(31, 73, 125);"
lang="EN-US"><o:p> </o:p></span></font></p>
<div>
<div
style="border-style: solid none none; border-color: rgb(181, 196, 223) -moz-use-text-color -moz-use-text-color; border-width: 1pt medium medium; padding: 3pt 0cm 0cm;">
<p class="MsoNormal"><b><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma; font-weight: bold;"
lang="EN-US">From:</span></font></b><font face="Tahoma" size="2"><span
style="font-size: 10pt; font-family: Tahoma;" lang="EN-US">
<a class="moz-txt-link-abbreviated" href="mailto:postgis-users-bounces@postgis.refractions.net">postgis-users-bounces@postgis.refractions.net</a>
[<a class="moz-txt-link-freetext" href="mailto:postgis-users-bounces@postgis.refractions.net">mailto:postgis-users-bounces@postgis.refractions.net</a>] <b><span
style="font-weight: bold;">On Behalf Of </span></b>Matt Doughty<br>
<b><span style="font-weight: bold;">Sent:</span></b> Wednesday, June
06, 2007
8:19 AM<br>
<b><span style="font-weight: bold;">To:</span></b>
<a class="moz-txt-link-abbreviated" href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
<b><span style="font-weight: bold;">Cc:</span></b> Sergio Jorrín
Abellán<br>
<b><span style="font-weight: bold;">Subject:</span></b>
[postgis-users] Slow
select from big table<o:p></o:p></span></font></p>
</div>
</div>
<p class="MsoNormal"><font face="Times New Roman" size="3"><span
style="font-size: 12pt;" lang="EN-US"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font face="Arial" size="2"><span
style="font-size: 10pt; font-family: Arial;" lang="EN-GB">Hi List,<o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Arial" size="2"><span
style="font-size: 10pt; font-family: Arial;" lang="EN-GB"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font face="Arial" size="2"><span
style="font-size: 10pt; font-family: Arial;" lang="EN-GB">I’ve got a
simple question, how can I speed up
this query? <o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Arial" size="2"><span
style="font-size: 10pt; font-family: Arial;" lang="EN-GB"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font face="Arial" size="2"><span
style="font-size: 10pt; font-family: Arial;" lang="EN-GB">SELECT COUNT
(*) FROM table1<o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Arial" size="2"><span
style="font-size: 10pt; font-family: Arial;" lang="EN-GB"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font face="Arial" size="2"><span
style="font-size: 10pt; font-family: Arial;" lang="EN-GB">Currently
it’s taking a little more than five
minutes to run on a table with <st1:metricconverter productid="3.4 m"
w:st="on">3.4 m</st1:metricconverter> rows. The table is gist indexed.
Is it normal that
Postgres takes so long?<o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Arial" size="2"><span
style="font-size: 10pt; font-family: Arial;" lang="EN-GB"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font face="Arial" size="2"><span
style="font-size: 10pt; font-family: Arial;" lang="EN-GB">Cheers,<o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Arial" size="2"><span
style="font-size: 10pt; font-family: Arial;" lang="EN-GB"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font face="Arial" size="2"><span
style="font-size: 10pt; font-family: Arial;" lang="EN-GB">Matt<o:p></o:p></span></font></p>
<p class="MsoNormal"><font face="Arial" size="2"><span
style="font-size: 10pt; font-family: Arial;" lang="EN-GB"><o:p> </o:p></span></font></p>
<table class="MsoNormalTable"
style="background: white none repeat scroll 0%; width: 100%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"
align="left" bgcolor="white" border="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td colspan="2" style="padding: 0.75pt;">
<p class="MsoNormal" style=""><font face="Times New Roman"
size="3"><span style="font-size: 12pt;" lang="EN-GB"> <o:p></o:p></span></font></p>
</td>
</tr>
<tr>
<td colspan="2" style="padding: 0.75pt;">
<p class="MsoNormal" style=""><font face="Times New Roman"
size="3"><span style="font-size: 12pt;" lang="EN-GB"> <o:p></o:p></span></font></p>
</td>
</tr>
<tr>
<td style="padding: 0.75pt;">
<p class="MsoNormal" style=""><font color="#2e3a75" face="Arial"
size="3"><span
style="font-size: 12pt; font-family: Arial; color: rgb(46, 58, 117);"
lang="EN-GB">Matt Doughty</span></font><span lang="EN-GB"><o:p></o:p></span></p>
</td>
<td rowspan="5" style="padding: 0.75pt;" valign="top">
<p class="MsoNormal" style=""><font face="Times New Roman"
size="3"><span style="font-size: 12pt;"><img id="_x0000_i1025"
src="cid:part1.08040604.04010300@refractions.net" height="100"
width="90"></span></font><span lang="EN-GB"><o:p></o:p></span></p>
</td>
</tr>
<tr>
<td style="padding: 0.75pt;">
<p class="MsoNormal" style=""><font color="#2e3a75" face="Arial"
size="3"><span
style="font-size: 12pt; font-family: Arial; color: rgb(46, 58, 117);"
lang="EN-GB">GEOGRAMA </span></font><font color="#2e3a75" face="Arial"><span
style="font-family: Arial; color: rgb(46, 58, 117);">S.L.</span></font><font
face="Arial"><span style="font-family: Arial;"><o:p></o:p></span></font></p>
</td>
</tr>
<tr>
<td style="padding: 0.75pt;">
<p class="MsoNormal" style=""><font color="#2e3a75" face="Arial"
size="3"><span
style="font-size: 12pt; font-family: Arial; color: rgb(46, 58, 117);">Tel.:
+34 945 13 13 72 652 77 14 15</span></font><font face="Arial"><span
style="font-family: Arial;"><o:p></o:p></span></font></p>
</td>
</tr>
<tr>
<td style="padding: 0.75pt;">
<p class="MsoNormal" style=""><font color="#2e3a75" face="Arial"
size="3"><span
style="font-size: 12pt; font-family: Arial; color: rgb(46, 58, 117);">Fax:
+34 945 23 03 40 </span></font><font face="Arial"><span
style="font-family: Arial;"><o:p></o:p></span></font></p>
</td>
</tr>
<tr>
<td style="padding: 0.75pt;">
<p class="MsoNormal" style=""><font color="#2e3a75" face="Arial"
size="3"><span
style="font-size: 12pt; font-family: Arial; color: rgb(46, 58, 117);"><a class="moz-txt-link-abbreviated" href="http://www.geograma.com">www.geograma.com</a></span></font><font
face="Arial"><span style="font-family: Arial;"><o:p></o:p></span></font></p>
</td>
</tr>
<tr>
<td colspan="2" style="padding: 0.75pt;">
<p class="MsoNormal" style=""><font face="Times New Roman"
size="3"><span style="font-size: 12pt;"> <o:p></o:p></span></font></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><font face="Times New Roman" size="3"><span
style="font-size: 12pt;"><o:p> </o:p></span></font></p>
</div>
<pre wrap="">
<hr size="4" width="90%">
_______________________________________________
postgis-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a>
<a class="moz-txt-link-freetext" href="http://postgis.refractions.net/mailman/listinfo/postgis-users">http://postgis.refractions.net/mailman/listinfo/postgis-users</a>
</pre>
</blockquote>
</body>
</html>