: Postgres IX

Started by Shaun Clementsabout 21 years ago3 messagesgeneral
Jump to latest
#1Shaun Clements
ShaunC@relyant.co.za

Can someone please explain to me , the use of
<snip>
CONSTRAINT ix_tablename
</snip>

Kind Regards,
Shaun Clements

#2Shaun Clements
ShaunC@relyant.co.za
In reply to: Shaun Clements (#1)
Re: : Postgres IX

Or better yet.
Can anyone explain the use of indexing, effecting the performance of select
query, using INDEXED columns, and non indexed columns.

I.E.

Select from table where column1 = 'xxxx' and column2 = 'xxxxx'

WHERE COLUMN1 is indexed, and COLUMN2 isnt.

Thanks in advance

Kind Regards,
Shaun Clements

#3Richard Huxton
dev@archonet.com
In reply to: Shaun Clements (#2)
Re: : Postgres IX

Shaun Clements wrote:

Or better yet.
Can anyone explain the use of indexing, effecting the performance of select
query, using INDEXED columns, and non indexed columns.

I.E.

Select from table where column1 = 'xxxx' and column2 = 'xxxxx'

WHERE COLUMN1 is indexed, and COLUMN2 isnt.

Well, if PG chooses to use an index on column1 alone, it will use the
index to find column1='xxxx' and then check all those rows to find
column2='xxxx'.

Of course, it might decide to just scan the whole table if it thinks
going to the index and then the table is more expensive.

EXPLAIN ANALYSE SELECT ... will show the full details of what it is doing.

--
Richard Huxton
Archonet Ltd