Connecting Tech Pros Worldwide Help | Site Map
 
 
LinkBack Thread Tools Search this Thread
  #1  
Old November 22nd, 2005, 08:50 AM
Marcio Caetano
Guest
 
Posts: n/a
Default Specifying a index

Hello !

Consider the examples bellow:

1- I create a table named TBA with columns ( A int , B char(10) )
2- I create an B-Tree index named IDXA using the column A
3- I create an GIST (or other) index named IDXB using the column A

So, I ask you:

Is it possible specify which index (IDXA or IDXB) my SELECT will use in a query ?
If so, how ?

Thanks in advance.

Marcio Caetano.



  #2  
Old November 22nd, 2005, 08:50 AM
Tom Lane
Guest
 
Posts: n/a
Default Re: Specifying a index

lima_caetano@yahoo.com.br (Marcio Caetano) writes:[color=blue]
> 1- I create a table named TBA with columns ( A int , B char(10) )
> 2- I create an B-Tree index named IDXA using the column A
> 3- I create an GIST (or other) index named IDXB using the column A[/color]
[color=blue]
> Is it possible specify which index (IDXA or IDXB) my SELECT will use in a query ?[/color]

No, not directly, but why would you create duplicate indexes? It would
be reasonable to have two indexes on the same column if they supported
different operator classes, but in that case the operator used in a
particular query would determine which index is applicable.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

  #3  
Old November 22nd, 2005, 08:52 AM
Marcio Caetano
Guest
 
Posts: n/a
Default Re: Specifying a index

Tom

In fact I'm creating two indexes (with different methods) in the same
column in order to analyze and register its performance. I need to
know wich one will be better when this table store more than
20.000.000 records.

What did you mean when you said "No, not directly" ? Is there an
indirect way of specifying a index ?

Regards,

Márcio Caetano.



tgl@sss.pgh.pa.us (Tom Lane) wrote in message news:<2879.1075851197@sss.pgh.pa.us>...[color=blue]
> lima_caetano@yahoo.com.br (Marcio Caetano) writes:[color=green]
> > 1- I create a table named TBA with columns ( A int , B char(10) )
> > 2- I create an B-Tree index named IDXA using the column A
> > 3- I create an GIST (or other) index named IDXB using the column A[/color]
>[color=green]
> > Is it possible specify which index (IDXA or IDXB) my SELECT will use in a query ?[/color]
>
> No, not directly, but why would you create duplicate indexes? It would
> be reasonable to have two indexes on the same column if they supported
> different operator classes, but in that case the operator used in a
> particular query would determine which index is applicable.
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend[/color]
  #4  
Old November 22nd, 2005, 08:53 AM
Ben
Guest
 
Posts: n/a
Default Re: Specifying a index

On Tue, 03 Feb 2004 07:04:05 -0800, Marcio Caetano wrote:
[color=blue]
> Consider the examples bellow:
>
> 1- I create a table named TBA with columns ( A int , B char(10) )
> 2- I create an B-Tree index named IDXA using the column A
> 3- I create an GIST (or other) index named IDXB using the column A
>
> So, I ask you:
>
> Is it possible specify which index (IDXA or IDXB) my SELECT will
> use in a query ?
> If so, how ?
>[/color]

Why not:

1 - Create the table
2 - Create index of type A
3 - ANALYZE the table so the DB knows the index
4 - Time the operations of interest
5 - Drop the index
5 - Create index of type B
6 - ANALYZE the table again
7 - Time the results

Tom, wouldn't that seem to do what he wants?

???

--Ben

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 205,414 network members.