How to create index using btree


#1

Hi,

I want to add a migration to create an index using btree , googled a
little but couldn’t find anything thats relevant.

is this possible in rails ? or is there a work around ?

appreciate your help , thanks

-CG


#2

On Nov 3, 9:46 pm, Geekforaday-Learnerforlifetime
removed_email_address@domain.invalid wrote:

Hi,

I want to add a migration to create an index using btree , googled a
little but couldn’t find anything thats relevant.

is this possible in rails ? or is there a work around ?

appreciate your help , thanks

-CG

I think btree is a fairly common default. For instance it’s the
default in postgres, right?
So if you just used the rails ‘add_index’ you’d get a btree index.
It looks like add_index doesn’t pass on extra options though (there
might be some
method that does this in rails I just don’t know it). So if you needed
to
specify the index method, you might have to execute the sql manually
in your migration.
YourARClass.connection.execute(‘CREATE INDEX … USING btree…’)
You’ll have to consult your db docs to establish its capabilities and
sql to use.


Daniel B.