Thread: How to speed up the database query?
Hi everyone! I'm looking for solution to speed up the database query, means that to get resultset as quicker as we can. For example if I've 700 records in the table it will take longer time compared if I've only 20 records. How do we speed upthe query?. Any query technique that can be applied?. Thus wild card query like : select * from tableA will cause query time increased compare to say select a,b from tableA. any help, prettymuch appreciated.
Abdul Wahab Dahalan <wahab@mimos.my> schrieb: > Hi everyone! > > I'm looking for solution to speed up the database query, means that to > get resultset as quicker as we can. 09:41 < akretschmer> ??tuning 09:41 < rtfm_please> For information about tuning 09:41 < rtfm_please> see http://www.powerpostgresql.com 09:41 < rtfm_please> or http://www.powerpostgresql.com/PerfList 09:41 < rtfm_please> or http://www.varlena.com/varlena/GeneralBits/116.php > > For example if I've 700 records in the table it will take longer time > compared if I've only 20 records. How do we speed up the query?. Any > query technique that can be applied?. Read the links above. You should use Indexe for searching. And you should use 'explain select ...' to see how the planer works. 09:43 < akretschmer> ??explain 09:43 < rtfm_please> For information about explain 09:43 < rtfm_please> see http://techdocs.postgresql.org/oscon2005/robert.treat/OSCON_Explaining_Explain_Public.sxi 09:43 < rtfm_please> or http://www.gtsm.com/oscon2003/toc.html 09:43 < rtfm_please> or http://www.postgresql.org/docs/current/static/sql-explain.html Regards, Andreas -- Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect. (Linus Torvalds) Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°
Of course as long as your table increases its records, the longer will take your query. I think what you want is to minimize the run time even though you have large tables. You should fine tune your database server (which I am still looking for the best configuration for my server haha). And get the most logical queries. Avoid unnecessary queries. -----Original Message----- From: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.org] On Behalf Of Abdul Wahab Dahalan Sent: Thursday, October 27, 2005 7:04 AM To: pgsql-sql@postgresql.org Subject: [SQL] How to speed up the database query? Hi everyone! I'm looking for solution to speed up the database query, means that to get resultset as quicker as we can. For example if I've 700 records in the table it will take longer time compared if I've only 20 records. How do we speed up the query?. Any query technique that can be applied?. Thus wild card query like : select * from tableA will cause query time increased compare to say select a,b from tableA. any help, prettymuch appreciated. ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings I choose Polesoft Lockspam to fight spam, and you? http://www.polesoft.com/refer.html
Run an analyse on your query, create your indexes according to that, and you have a better performing query. Getting a resultset display faster will depend on your driver/RAM/client -----Original Message----- From: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.org] On Behalf Of Abdul Wahab Dahalan Sent: Thursday, October 27, 2005 12:34 PM To: pgsql-sql@postgresql.org Subject: [SQL] How to speed up the database query? Hi everyone! I'm looking for solution to speed up the database query, means that to get resultset as quicker as we can. For example if I've 700 records in the table it will take longer time compared if I've only 20 records. How do we speed up the query?. Any query technique that can be applied?. Thus wild card query like : select * from tableA will cause query time increased compare to say select a,b from tableA. any help, prettymuch appreciated. ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings
On Thu, Oct 27, 2005 at 15:03:36 +0800, Abdul Wahab Dahalan <wahab@mimos.my> wrote: > Hi everyone! > > I'm looking for solution to speed up the database query, means that to get resultset as quicker as we can. > > For example if I've 700 records in the table it will take longer time compared if I've only 20 records. How do we speedup the query?. Any query technique that can be applied?. > > Thus wild card query like : select * from tableA will cause query time increased compare to say select a,b from tableA. > > any help, prettymuch appreciated. Why don't you run explain analyze on the real query you are trying to speed up and show us the output along with the query and relevant table and view definitions. Yes, specifying fewer columns will probably significantly speed things up, as you will be transmitting less data over the network. There aren't magic ways to speed up queries return every row in a table.
Have you taken a look at http://www.postgresql.org/docs/8.0/interactive/performance-tips.html ? On Thu, Oct 27, 2005 at 03:03:36PM +0800, Abdul Wahab Dahalan wrote: > Hi everyone! > > I'm looking for solution to speed up the database query, means that to get resultset as quicker as we can. > > For example if I've 700 records in the table it will take longer time compared if I've only 20 records. How do we speedup the query?. Any query technique that can be applied?. > > Thus wild card query like : select * from tableA will cause query time increased compare to say select a,b from tableA. > > any help, prettymuch appreciated. > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings > -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461