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: Where do a ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 6 of 8 Topic 4028 of 4424
Post > Topic >>

Re: Where do a novice do to make it run faster?

by lists@[EMAIL PROTECTED] (PFC) Apr 28, 2008 at 08:23 PM

You got the order slightly wrong I guess.

> 1) hardware

	Would only come first if your RAM is really too small, or you use
RAID5=20=
=20
on write-heavy tables, or what limits you is transaction fsync (hint :=20=
=20
8.3).
	Adding RAM is cheap.

> 2) rewriting my queries and table structures

	This should really come first.
	Log expensive queries. Note that an expensive query can be a slow query,=
=20=20
or be a rather fast query that you execute lots of times, or a very
simple=
=20=20
and fast query that you execute really really too often.

	Now ask yourself :
* What is this query supposed to do ?

* Do I need this query ?

	Example :
	You put your sessions in a database ?
	=3D> Perhaps put them in the good old filesystem ?

	Your PHP is loading lots of configuration from the database for every=20=
=20
page.
	=3D> Cache it, generate some PHP code once and include it, put it in the=
=20=20
session if it depends on the user, but don't reload the thing on each
page=
=20=20
!

	This feature is useless
	=3D> Do you really need to display a birthday cake on your forum for
those=
=20=20
users who have their birthday today ?

	UPDATEs...
	=3D> Do you really need to update the last time a user was online
every=20=
=20
time ? What about updating it every 5 minutes instead ?

* Is this query inside a loop ?
	=3D> Use JOIN.

* Do I need all the rows from this query ?

	Example :
You use pagination and perform the same query changing LIMIT/OFFSET ?
=3D> Perform the query once, retrieve the first N pages of result, cache
it=
=20=20
in the session or in a table.

* You have a website ?
=3D> Use lighttpd and fastcgi

* Do I need all the columns from this query ?

* Do I suffer from locking ?

	etc.


Now you should see some easy targets.
For the queries that are slow, use EXPLAIN ANALYZE.
Question your schema.
etc.

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




 8 Posts in Topic:
Where do a novice do to make it run faster?
gentosaker@[EMAIL PROTECT  2008-04-28 17:56:27 
Re: Where do a novice do to make it run faster?
Dennis Muhlestein <djm  2008-04-28 10:10:35 
Re: Where do a novice do to make it run faster?
kometen@[EMAIL PROTECTED]  2008-04-28 18:19:30 
Re: Where do a novice do to make it run faster?
scrawford@[EMAIL PROTECTE  2008-04-28 09:34:14 
Re: Where do a novice do to make it run faster?
Chris Browne <cbbrowne  2008-04-28 12:35:18 
Re: Where do a novice do to make it run faster?
lists@[EMAIL PROTECTED]   2008-04-28 20:23:12 
Re: Where do a novice do to make it run faster?
gentosaker@[EMAIL PROTECT  2008-04-29 11:09:48 
Re: Where do a novice do to make it run faster?
tgl@[EMAIL PROTECTED] (T  2008-04-29 10:20:48 

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 8:04:26 CST 2008.