Thread: Limit on multi-field indexes?

Limit on multi-field indexes?

From
Stephen Davies
Date:
Am I correct in believing that there is a limit of seven columns in a
multi-filed index?

If so, is it possible to increase this limit (to at least eight) ?

Cheers and thanks,

Stephen.

========================================================================
Stephen Davies Consulting                                            scldad@sdc.com.au
Adelaide, South Australia.                                             Voice: 61-8-82728863
Computing & Network solutions.                                     Fax: 61-8-82741015



Re: [GENERAL] Limit on multi-field indexes?

From
Bruce Momjian
Date:
> Am I correct in believing that there is a limit of seven columns in a
> multi-filed index?
>
> If so, is it possible to increase this limit (to at least eight) ?
>
> Cheers and thanks,

Not easily.  The columns are stored in an int28 column, that holds 8
two-byte integer.  We would have to change that to a larger field.  Very
few people have asked for this.

--
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
http://www.op.net/~candle              |  (610) 353-9879(w)
  +  If your life is a hard drive,     |  (610) 853-3000(h)
  +  Christ can be your backup.        |

Re: [GENERAL] Limit on multi-field indexes?

From
Stephen Davies
Date:
> > Am I correct in believing that there is a limit of seven columns in a
> > multi-filed index?
> >
> > If so, is it possible to increase this limit (to at least eight) ?
> >
> > Cheers and thanks,
>
> Not easily.  The columns are stored in an int28 column, that holds 8
> two-byte integer.  We would have to change that to a larger field.  Very
> few people have asked for this.
>
Getting desperate here.

If it holds 8 integers, why can't I have 8 columns in a multi-field index?

I am currently writing a tool to replicate any database to a PostgreSQL mirror
and the very first customer for this tool has several tables with 8 fields in
their primary key. Sod's Law:-((

Cheers and thanks,
Stephen.



========================================================================
Stephen Davies Consulting                                            scldad@sdc.com.au
Adelaide, South Australia.                                             Voice: 61-8-82728863
Computing & Network solutions.                                     Fax: 61-8-82741015



How do I read postgres's logs?

From
Jeremy Hansen
Date:
What do I use to read postgres's log, pg_log???  Please reply to my email
if possible.

Thanks
-jeremy


Re: [GENERAL] Limit on multi-field indexes?

From
darcy@druid.net (D'Arcy J.M. Cain)
Date:
Thus spake Stephen Davies
> I am currently writing a tool to replicate any database to a PostgreSQL mirror
> and the very first customer for this tool has several tables with 8 fields in
> their primary key. Sod's Law:-((

Could that database be badly in need of a redesign?  :-)

--
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 424 2871     (DoD#0082)    (eNTP)   |  what's for dinner.

Re: [GENERAL] Limit on multi-field indexes?

From
Bruce Momjian
Date:
> > > Am I correct in believing that there is a limit of seven columns in a
> > > multi-filed index?
> > >
> > > If so, is it possible to increase this limit (to at least eight) ?
> > >
> > > Cheers and thanks,
> >
> > Not easily.  The columns are stored in an int28 column, that holds 8
> > two-byte integer.  We would have to change that to a larger field.  Very
> > few people have asked for this.
> >
> Getting desperate here.
>
> If it holds 8 integers, why can't I have 8 columns in a multi-field index?
>
> I am currently writing a tool to replicate any database to a PostgreSQL mirror
> and the very first customer for this tool has several tables with 8 fields in
> their primary key. Sod's Law:-((

There is no field in pg_index to determine the number of fields in the
index, so it scans pg_index.indkey until it hits a 0.  Now, I suppose we
could change the code so it goes through indkey until it gets a 0, or
reaches the eighth entry.

--
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
http://www.op.net/~candle              |  (610) 353-9879(w)
  +  If your life is a hard drive,     |  (610) 853-3000(h)
  +  Christ can be your backup.        |

Re: [GENERAL] Limit on multi-field indexes?

From
Bruce Momjian
Date:
> If it holds 8 integers, why can't I have 8 columns in a multi-field index?
>
> I am currently writing a tool to replicate any database to a PostgreSQL mirror
> and the very first customer for this tool has several tables with 8 fields in
> their primary key. Sod's Law:-((

OK, I am committing changes which will allow 8-key indexes, rather than
just seven.  Please test this at your convenience.

--
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
http://www.op.net/~candle              |  (610) 353-9879(w)
  +  If your life is a hard drive,     |  (610) 853-3000(h)
  +  Christ can be your backup.        |

Re: [GENERAL] Limit on multi-field indexes?

From
Stephen Davies
Date:
> > If it holds 8 integers, why can't I have 8 columns in a multi-field index?
> >
> > I am currently writing a tool to replicate any database to a PostgreSQL mirror
> > and the very first customer for this tool has several tables with 8 fields in
> > their primary key. Sod's Law:-((
>
> OK, I am committing changes which will allow 8-key indexes, rather than
> just seven.  Please test this at your convenience.
>

Good on ya Bruce!!

(Traditional Aussie saying ;-) )

Thank you very much. Where might I find the patch?

Cheers and thanks,
Stephen.



========================================================================
Stephen Davies Consulting                                            scldad@sdc.com.au
Adelaide, South Australia.                                             Voice: 61-8-82728863
Computing & Network solutions.                                     Fax: 61-8-82741015



Re: [GENERAL] Limit on multi-field indexes?

From
Bruce Momjian
Date:
> > > If it holds 8 integers, why can't I have 8 columns in a multi-field index?
> > >
> > > I am currently writing a tool to replicate any database to a PostgreSQL mirror
> > > and the very first customer for this tool has several tables with 8 fields in
> > > their primary key. Sod's Law:-((
> >
> > OK, I am committing changes which will allow 8-key indexes, rather than
> > just seven.  Please test this at your convenience.
> >
>
> Good on ya Bruce!!
>
> (Traditional Aussie saying ;-) )
>
> Thank you very much. Where might I find the patch?

You have to get involved in the 6.4 beta by joining the hackers list,
and/or get a snapshot from the ftp site that has a date after today's
date.

--
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
http://www.op.net/~candle              |  (610) 353-9879(w)
  +  If your life is a hard drive,     |  (610) 853-3000(h)
  +  Christ can be your backup.        |