Thread: Re: Undocumented feature costs a lot of performance in COPY

Re: Undocumented feature costs a lot of performance in COPY

From
Gavin Sherry
Date:
On Fri, 28 Dec 2001, Bruce Momjian wrote:

> > Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > > We could support keywords DELIMITER and DELIMITERS and only document
> > > the first one.
> >
> > One could also argue that it should be WITH DELIMITER for more
> > consistency with the other optional clauses.
> >
> > But let's put that in the TODO list, not try to get it done now...
>
> Updated TODO:
>
> COPY
>     ...
>         o Change syntax to WITH DELIMITER, (keep old syntax around?)
>

An attached patch implements this. The problem with implementing this is
that the new syntax is:

    .... WITH DELIMITERS '<delim>' WITH NULL AS '<char>'

Naturally, this leads to a shift/reduce conflict. Solution is more or less
that used with CREATE DATABASE WITH ... WITH ... etc. The only ugly bit
was mixing this with the old USING DELIMITERS ... syntax. I don't like the
solution -- I get the feeling there's a better way to do it.

The other option of course is to update yylex() to create a new token
in the same way that the UNIONJOIN terminal is created. But I think this
is a bit messy.

Ideas or is this okay?

Gavin

Attachment

Re: Undocumented feature costs a lot of performance in COPY

From
Bruce Momjian
Date:
Saved for 7.3.


---------------------------------------------------------------------------

Gavin Sherry wrote:
> On Fri, 28 Dec 2001, Bruce Momjian wrote:
>
> > > Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > > > We could support keywords DELIMITER and DELIMITERS and only document
> > > > the first one.
> > >
> > > One could also argue that it should be WITH DELIMITER for more
> > > consistency with the other optional clauses.
> > >
> > > But let's put that in the TODO list, not try to get it done now...
> >
> > Updated TODO:
> >
> > COPY
> >     ...
> >         o Change syntax to WITH DELIMITER, (keep old syntax around?)
> >
>
> An attached patch implements this. The problem with implementing this is
> that the new syntax is:
>
>     .... WITH DELIMITERS '<delim>' WITH NULL AS '<char>'
>
> Naturally, this leads to a shift/reduce conflict. Solution is more or less
> that used with CREATE DATABASE WITH ... WITH ... etc. The only ugly bit
> was mixing this with the old USING DELIMITERS ... syntax. I don't like the
> solution -- I get the feeling there's a better way to do it.
>
> The other option of course is to update yylex() to create a new token
> in the same way that the UNIONJOIN terminal is created. But I think this
> is a bit messy.
>
> Ideas or is this okay?
>
> Gavin

Content-Description:

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: Undocumented feature costs a lot of performance in COPY

From
Bruce Momjian
Date:
Your patch has been added to the PostgreSQL unapplied patches list at:

    http://candle.pha.pa.us/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

---------------------------------------------------------------------------


Gavin Sherry wrote:
> On Fri, 28 Dec 2001, Bruce Momjian wrote:
>
> > > Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > > > We could support keywords DELIMITER and DELIMITERS and only document
> > > > the first one.
> > >
> > > One could also argue that it should be WITH DELIMITER for more
> > > consistency with the other optional clauses.
> > >
> > > But let's put that in the TODO list, not try to get it done now...
> >
> > Updated TODO:
> >
> > COPY
> >     ...
> >         o Change syntax to WITH DELIMITER, (keep old syntax around?)
> >
>
> An attached patch implements this. The problem with implementing this is
> that the new syntax is:
>
>     .... WITH DELIMITERS '<delim>' WITH NULL AS '<char>'
>
> Naturally, this leads to a shift/reduce conflict. Solution is more or less
> that used with CREATE DATABASE WITH ... WITH ... etc. The only ugly bit
> was mixing this with the old USING DELIMITERS ... syntax. I don't like the
> solution -- I get the feeling there's a better way to do it.
>
> The other option of course is to update yylex() to create a new token
> in the same way that the UNIONJOIN terminal is created. But I think this
> is a bit messy.
>
> Ideas or is this okay?
>
> Gavin

Content-Description:

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: Undocumented feature costs a lot of performance in COPY

From
Bruce Momjian
Date:
Gavin, can I get documentation patches to match this patch?  Thanks.

---------------------------------------------------------------------------

Gavin Sherry wrote:
> On Fri, 28 Dec 2001, Bruce Momjian wrote:
>
> > > Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > > > We could support keywords DELIMITER and DELIMITERS and only document
> > > > the first one.
> > >
> > > One could also argue that it should be WITH DELIMITER for more
> > > consistency with the other optional clauses.
> > >
> > > But let's put that in the TODO list, not try to get it done now...
> >
> > Updated TODO:
> >
> > COPY
> >     ...
> >         o Change syntax to WITH DELIMITER, (keep old syntax around?)
> >
>
> An attached patch implements this. The problem with implementing this is
> that the new syntax is:
>
>     .... WITH DELIMITERS '<delim>' WITH NULL AS '<char>'
>
> Naturally, this leads to a shift/reduce conflict. Solution is more or less
> that used with CREATE DATABASE WITH ... WITH ... etc. The only ugly bit
> was mixing this with the old USING DELIMITERS ... syntax. I don't like the
> solution -- I get the feeling there's a better way to do it.
>
> The other option of course is to update yylex() to create a new token
> in the same way that the UNIONJOIN terminal is created. But I think this
> is a bit messy.
>
> Ideas or is this okay?
>
> Gavin

Content-Description:

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

WITH DELIMITERS in COPY

From
Bruce Momjian
Date:
Seems the original title about "feature causes performance in COPY" was
confusing. This patch merely fixes the identified TODO item in the
grammar about using WITH in COPY.

I will apply tomorrow.

---------------------------------------------------------------------------

Gavin Sherry wrote:
> On Fri, 28 Dec 2001, Bruce Momjian wrote:
>
> > > Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > > > We could support keywords DELIMITER and DELIMITERS and only document
> > > > the first one.
> > >
> > > One could also argue that it should be WITH DELIMITER for more
> > > consistency with the other optional clauses.
> > >
> > > But let's put that in the TODO list, not try to get it done now...
> >
> > Updated TODO:
> >
> > COPY
> >     ...
> >         o Change syntax to WITH DELIMITER, (keep old syntax around?)
> >
>
> An attached patch implements this. The problem with implementing this is
> that the new syntax is:
>
>     .... WITH DELIMITERS '<delim>' WITH NULL AS '<char>'
>
> Naturally, this leads to a shift/reduce conflict. Solution is more or less
> that used with CREATE DATABASE WITH ... WITH ... etc. The only ugly bit
> was mixing this with the old USING DELIMITERS ... syntax. I don't like the
> solution -- I get the feeling there's a better way to do it.
>
> The other option of course is to update yylex() to create a new token
> in the same way that the UNIONJOIN terminal is created. But I think this
> is a bit messy.
>
> Ideas or is this okay?
>
> Gavin

Content-Description:

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: Undocumented feature costs a lot of performance in COPY

From
Bruce Momjian
Date:
Here is the original patch, which is now rejected as we discuss a new
patch on hackers.

---------------------------------------------------------------------------

Gavin Sherry wrote:
> On Fri, 28 Dec 2001, Bruce Momjian wrote:
>
> > > Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > > > We could support keywords DELIMITER and DELIMITERS and only document
> > > > the first one.
> > >
> > > One could also argue that it should be WITH DELIMITER for more
> > > consistency with the other optional clauses.
> > >
> > > But let's put that in the TODO list, not try to get it done now...
> >
> > Updated TODO:
> >
> > COPY
> >     ...
> >         o Change syntax to WITH DELIMITER, (keep old syntax around?)
> >
>
> An attached patch implements this. The problem with implementing this is
> that the new syntax is:
>
>     .... WITH DELIMITERS '<delim>' WITH NULL AS '<char>'
>
> Naturally, this leads to a shift/reduce conflict. Solution is more or less
> that used with CREATE DATABASE WITH ... WITH ... etc. The only ugly bit
> was mixing this with the old USING DELIMITERS ... syntax. I don't like the
> solution -- I get the feeling there's a better way to do it.
>
> The other option of course is to update yylex() to create a new token
> in the same way that the UNIONJOIN terminal is created. But I think this
> is a bit messy.
>
> Ideas or is this okay?
>
> Gavin

Content-Description:

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026