pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Joe Conway <mail@joeconway.com>
Cc: Hackers (PostgreSQL) <pgsql-hackers@postgresql.org>
Subject: Re: VALUES clause memory optimization
Date: Fri, 04 Aug 2006 00:56:26 -0400
Message-ID: <2050.1154667386@sss.pgh.pa.us> (raw)
In-Reply-To: <44D2CCA4.8040507@joeconway.com>
References: <44B69778.5050104@dunslane.net>
	<50461.84.63.113.55.1152832991.squirrel@pezone.net>
	<ECCAAC0A3182895D3D12B0E8@[172.26.14.247]>
	<44B7ADFC.90205@dunslane.net>
	<44D03D9F.80203@joeconway.com>
	<15263.1154526181@sss.pgh.pa.us>
	<44D0AF87.2030304@joeconway.com>
	<16892.1154528708@sss.pgh.pa.us>
	<44D0B9C1.2020608@joeconway.com>
	<17704.1154534183@sss.pgh.pa.us>
	<44D140DF.5080209@joeconway.com>
	<2922.1154609337@sss.pgh.pa.us>
	<44D2CCA4.8040507@joeconway.com>

Joe Conway <mail@joeconway.com> writes:
> What about for the specific case of an InsertStmt? It seems that we 
> could at least get away with freeing the raw-expression list in that case.

Not sure ... what about rules, BETWEEN, yadda yadda?

> In terms of freeing an entire arbitrary node, could we create a 
> backend/nodes/freefuncs.c file that does a recursive freeObject() 
> similar to the way copyObject() does in backend/nodes/copyfuncs.c?

We got rid of freefuncs.c years ago, for good and sufficient reasons
that have not gone away.  The problem is exactly that you don't know
whether any shortcuts were taken in constructing the node tree:
multiple links, pointers to constants, pointers to stuff that wasn't
supposed to be freed are all severe hazards.

>> My advice is to get that low-hanging fruit
>> in transformInsertRow and leave the other ideas for 8.3.

> OK. This should be safe also, correct?

Yes, but what's your point?  The case that seems worth trying to
optimize is "INSERT INTO foo VALUES ... real long list ...".  Certainly
the MySQL crowd is not going to be stressing transformValuesClause,
because they don't know it exists.

$ mysql test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 12 to server version: 5.0.22

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> values (1),(2);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'values (1),(2)' at line 1
mysql> select * from (values (1),(2)) as x(y);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'values (1),(2)) as x(y)' at line 1
mysql> select * from foo where x in (values (1),(2));
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1),(2))' at line 1
mysql> 

mysql shortcomings aside, I don't really see the use-case for enormously
long VALUES lists anywhere except the bulk-data-load scenario, ie,
exactly INSERT ... VALUES.  So I don't feel a need to be real tense
in transformValuesClause.

			regards, tom lane



view thread (4+ messages)  latest in thread

Message-ID: <2050.1154667386@sss.pgh.pa.us>
Permalink:  ../2050.1154667386@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2050.1154667386@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, mail@joeconway.com, pgsql-hackers@postgresql.org
  Subject: Re: VALUES clause memory optimization
  In-Reply-To: <2050.1154667386@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox