Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Performance > Fwd: count * pe...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 3850 of 4424
Post > Topic >>

Fwd: count * performance issue

by sathiya.psql@[EMAIL PROTECTED] ("sathiya psql") Mar 6, 2008 at 12:18 PM

------=_Part_3603_23209377.1204786105219
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

---------- Forwarded message ----------
From: sathiya psql <sathiya.psql@[EMAIL PROTECTED]
>
Date: Thu, Mar 6, 2008 at 12:17 PM
Subject: Re: [PERFORM] count * performance issue
To: "A. Kretschmer" <andreas.kretschmer@[EMAIL PROTECTED]
>
Cc: psql-performance@[EMAIL PROTECTED]
 i can use if i want the count of the whole table, but i require
for
some of the rows with WHERE condition....

so how to do that ???


On Thu, Mar 6, 2008 at 12:06 PM, A. Kretschmer <
andreas.kretschmer@[EMAIL PROTECTED]
> wrote:

> am  Thu, dem 06.03.2008, um  1:26:46 -0500 mailte Mark Mielke folgendes:
> >
> >
> >         There aren't a general solution. If you realy need the exact
> count of
> >         tuples than you can play with a TRIGGER and increase/decrease
> the
> >         tuple-count for this table in an extra table.
> >
> >
> > Of course, this means accepting the cost of obtaining update locks on
> the count
> > table.
> >
> > The original poster should understand that they can either get a fast
> estimated
> > count, or they can get a slow accurate count (either slow in terms of
> select
> > using count(*) or slow in terms of updates using triggers and
locking).
> >
> > Other systems have their own issues. An index scan may be faster than
a
> table
> > scan for databases that can accurately determine counts using only the
> index,
>
> No. The current index-implementation contains no information about the
> row-visibility within the current transaction. You need to scan the
> whole data-table to obtain if the current row are visible within the
> current transaction.
>
>
> > but it's still a relatively slow operation, and people don't normally
> need an
> > accurate count for records in the range of 100,000+? :-)
>
> right.
>
>
> Andreas
> --
> Andreas Kretschmer
> Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
> GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net
>
> --
> Sent via pgsql-performance mailing list
(pgsql-performance@[EMAIL PROTECTED]
)
> To make changes to your subscription:
>
>
http://mail.postgresql.org/mj/mj_wwwusr?domain=postgresql.org&extra=pgsql-performance
>

------=_Part_3603_23209377.1204786105219
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

<br><br><div class="gmail_quote">---------- Forwarded message
----------<br>From: <b class="gmail_sendername">sathiya psql</b> &lt;<a
href="mailto:sathiya.psql@[EMAIL PROTECTED]
">sathiya.psql@[EMAIL PROTECTED]
>&gt;<br>Date:
Thu, Mar 6, 2008 at 12:17 PM<br>
Subject: Re: [PERFORM] count * performance issue<br>To: &quot;A.
Kretschmer&quot; &lt;<a
href="mailto:andreas.kretschmer@[EMAIL PROTECTED]
">andreas.kretschmer@[EMAIL PROTECTED]
>&gt;<br>Cc:
<a
href="mailto:psql-performance@[EMAIL PROTECTED]
">psql-performance@[EMAIL PROTECTED]
><br>
<br><br>TRIGGER i can use if i want the count of the whole table, but i
require for some of the rows with WHERE condition....<br><br>so how to do
that ???<div><div></div><div class="Wj3C7c"><br><br><div
class="gmail_quote">
On Thu, Mar 6, 2008 at 12:06 PM, A. Kretschmer &lt;<a
href="mailto:andreas.kretschmer@[EMAIL PROTECTED]
"
target="_blank">andreas.kretschmer@[EMAIL PROTECTED]
>&gt; wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204,
204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">am &nbsp;Thu,
dem 06.03.2008, um &nbsp;1:26:46 -0500 mailte Mark Mielke folgendes:<br>
<div>&gt;<br>
&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; There aren&#39;t a general solution. If
you realy need the exact count of<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; tuples than you can play with a TRIGGER
and increase/decrease the<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; tuple-count for this table in an extra
table.<br>
&gt;<br>
&gt;<br>
&gt; Of course, this means accepting the cost of obtaining update locks on
the count<br>
&gt; table.<br>
&gt;<br>
&gt; The original poster should understand that they can either get a fast
estimated<br>
&gt; count, or they can get a slow accurate count (either slow in terms of
select<br>
&gt; using count(*) or slow in terms of updates using triggers and
locking).<br>
&gt;<br>
&gt; Other systems have their own issues. An index scan may be faster than
a table<br>
&gt; scan for databases that can accurately determine counts using only
the index,<br>
<br>
</div>No. The current index-implementation contains no information about
the<br>
row-visibility within the current transaction. You need to scan the<br>
whole data-table to obtain if the current row are visible within the<br>
current transaction.<br>
<div><br>
<br>
&gt; but it&#39;s still a relatively slow operation, and people don&#39;t
normally need an<br>
&gt; accurate count for records in the range of 100,000+? :-)<br>
<br>
</div>right.<br>
<div><div></div><div><br>
<br>
Andreas<br>
--<br>
Andreas Kretschmer<br>
Kontakt: &nbsp;Heynitz: 035242/47150, &nbsp; D1: 0160/7141639 (mehr: -&gt;
Header)<br>
GnuPG-ID: &nbsp; 0x3FFF606C, privat 0x7F4584DA &nbsp; <a
href="http://wwwkeys.de.pgp.net"
target="_blank">http://wwwkeys.de.pgp.net</a><br>
<br>
--<br>
Sent via pgsql-performance mailing list (<a
href="mailto:pgsql-performance@[EMAIL PROTECTED]
"
target="_blank">pgsql-performance@[EMAIL PROTECTED]
>)<br>
To make changes to your subscription:<br>
<a
href="http://mail.postgresql.org/mj/mj_wwwusr?domain=postgresql.org&amp;extra=pgsql-performance"
target="_blank">http://mail.postgresql.org/mj/mj_wwwusr?domain=postgresql.org&amp;extra=pgsql-performance</a><br>
</div></div></blockquote></div><br>
</div></div></div><br>

------=_Part_3603_23209377.1204786105219--
 




 1 Posts in Topic:
Fwd: count * performance issue
sathiya.psql@[EMAIL PROTE  2008-03-06 12:18:25 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Dec 1 7:11:08 CST 2008.