On 4/23/07, Marco Bambini <[EMAIL PROTECTED]> wrote:
As a performance test I created a db with 300,000 records, table is:

CREATE TABLE table1 (a INTEGER, b INTEGER)

a query like:
SELECT * FROM table1 WHERE a=5 AND b=11;
takes 0.281 secs.

if I add two indexes:
CREATE INDEX index1 ON table1(a);
CREATE INDEX index2 ON table1(b);

the same query is about two times slower, it takes 0.463 secs.
(I know that only one index is used by the query).

Try

CREATE INDEX index_ab ON table1 (a, b);

and test.



I repeated the test several times and results are confirmed...

Anyone have an explanation?
---
Marco Bambini


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------




--
Puneet Kishor http://punkish.eidesis.org/
Nelson Inst. for Env. Studies, UW-Madison http://www.nelson.wisc.edu/
Open Source Geospatial Foundation http://www.osgeo.org/education/
---------------------------------------------------------------------
collaborate, communicate, compete
=====================================================================

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to