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 > Re: large table...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 14 of 15 Topic 3978 of 4424
Post > Topic >>

Re: large tables and simple "= constant" queries using indexes

by lists@[EMAIL PROTECTED] (PFC) Apr 10, 2008 at 12:31 AM

> Hi, I've started my first project with Postgres (after several years of=
=20=20
> using Mysql), and I'm having an odd performance problem that I was=20=20
> hoping someone might be able to explain the cause of.
>
> ----My query----
>     - select count(*) from gene_prediction_view where gene_ref =3D 523
>     - takes 26 seconds to execute, and returns 2400 (out of a total
of=20=
=20
> 15 million records in the table)
>  ---My problem---
>     Using a single-column index to count 2400 records which are exactly=
=20=20
> one constant value doesn't sound like something that would take 26=20=20
> seconds. What's the slowdown? Any silver bullets that might fix this?

	* Please post an EXPLAIN ANALYZE of your query which will allow to
choose=
=20=20
between these two options :
	- If Postgres uses a bad plan (like a seq scan), you need to up the=20=20
statistics for this column
	- If you get the correct plan (index scan or bitmap index scan) then
it=20=
=20
is likely that postgres does one disk seek per row that has to be
counted.=
=20=20
26 seconds for 2400 rows would be consistent with a 10ms seek time.
The=20=
=20
unmistakable sign is that re-running the query will result in a very fast=
=20=20
runtime (I'd say a couple ms for counting 2400 rows if no disk IO is=20=20
involved).


--=20
Sent via pgsql-performance mailing list (pgsql-performance@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance
 




 15 Posts in Topic:
large tables and simple "= constant" queries using indexes
john.e.beaver@[EMAIL PROT  2008-04-09 16:58:27 
Re: large tables and simple "= constant" queries using
acmmailing@[EMAIL PROTECT  2008-04-09 23:21:20 
Re: large tables and simple "= constant" queries using
acmmailing@[EMAIL PROTECT  2008-04-10 09:13:39 
Re: large tables and simple "= constant" queries using indexes
lists@[EMAIL PROTECTED]   2008-04-10 10:25:48 
Re: large tables and simple "= constant" queries using
matthew@[EMAIL PROTECTED]  2008-04-10 10:51:13 
Re: large tables and simple "= constant" queries using
john.e.beaver@[EMAIL PROT  2008-04-10 10:44:59 
Re: large tables and simple "= constant" queries using indexes
erik@[EMAIL PROTECTED] (  2008-04-10 10:02:48 
Re: large tables and simple "= constant" queries using indexes
Gaetano Mendola <mendo  2008-04-10 18:18:15 
Re: large tables and simple "= constant" queries using indexes
john.e.beaver@[EMAIL PROT  2008-04-10 12:37:45 
Re: large tables and simple "= constant" queries using indexes
lists@[EMAIL PROTECTED]   2008-04-10 23:37:50 
Re: large tables and simple "= constant" queries using
gsmith@[EMAIL PROTECTED]   2008-04-10 14:47:59 
Re: large tables and simple "= constant" queries using
wmoran@[EMAIL PROTECTED]   2008-04-09 17:36:09 
Re: large tables and simple "= constant" queries using
jgh@[EMAIL PROTECTED] (J  2008-04-09 23:07:50 
Re: large tables and simple "= constant" queries using indexes
lists@[EMAIL PROTECTED]   2008-04-10 00:31:00 
Re: large tables and simple "= constant" queries using
wmoran@[EMAIL PROTECTED]   2008-04-10 13:08:54 

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 9:05:36 CST 2008.