On Thu, Aug 05, 2010 at 10:14:10AM +0200, Fabian Groffen wrote:
> On 05-08-2010 09:18:51 +0200, Stefan Manegold wrote:
> > Just for info, here are the simplified terms to facilitate before & after
> > comparison.
> 
> before:
> 
> sql>select NULL;
> +------------------------------------------------------------------------------+
> | single_value                                                                
>  |
> +==============================================================================+
> | null                                                                        
>  |
> +------------------------------------------------------------------------------+
> 1 tuple (0.668ms)
> sql>select NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL;
> +--------+---------+---------+---------+---------+---------+---------+---------+
> | single | single_ | single_ | single_ | single_ | single_ | single_ | 
> single_ |
> : _value : value   : value   : value   : value   : value   : value   : value  
>  :
> +========+=========+=========+=========+=========+=========+=========+=========+
> | null   | null    | null    | null    | null    | null    | null    | null   
>  |
> +--------+---------+---------+---------+---------+---------+---------+---------+
> 1 tuple (1.065ms)
> 
> after:
> 
> sql>select NULL;
> +--------------------------------------------------------------------+
> | single_value                                                       |
> +====================================================================+
> | null                                                               |
> +--------------------------------------------------------------------+
> 1 tuple (0.656ms)
> sql>select NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL;
> +-------+-------+-------+--------+--------+--------+--------+--------+
> | singl | singl | singl | single | single | single | single | single |
> : e_val : e_val : e_val : _value : _value : _value : _value : _value :
> : ue    : ue    : ue    :        :        :        :        :        :
> +=======+=======+=======+========+========+========+========+========+
> | null  | null  | null  | null   | null   | null   | null   | null   |
> +-------+-------+-------+--------+--------+--------+--------+--------+
> 1 tuple (1.086ms)
> 
> IOW no real improvement, given that 10 chars are no longer in use now.

Indeed; in more detail:

Before (Jun2010):

$ echo $COLUMNS
80
$ mclient -lsql -fsql -s'select NULL;'
+------------------------------------------------------------------------------+
| single_value                                                                 |
+==============================================================================+
| null                                                                         |
+------------------------------------------------------------------------------+
1 tuple
$ mclient -lsql -fsql -s'select NULL;' | wc -L
80
$ mclient -lsql -fsql -s'select NULL,NULL,NULL;' 
+-------------------------+-------------------------+--------------------------+
| single_value            | single_value            | single_value             |
+=========================+=========================+==========================+
| null                    | null                    | null                     |
+-------------------------+-------------------------+--------------------------+
1 tuple
$ mclient -lsql -fsql -s'select NULL,NULL,NULL;' | wc -L
80


After (default):

$ echo $COLUMNS
80
$ mclient -lsql -fsql -s'select NULL;'
+--------------------------------------------------------------------+
| single_value                                                       |
+====================================================================+
| null                                                               |
+--------------------------------------------------------------------+
1 tuple
$ mclient -lsql -fsql -s'select NULL;' | wc -L
70
$ mclient -lsql -fsql -s'select NULL,NULL,NULL;' 
+----------------------+----------------------+----------------------+
| single_value         | single_value         | single_value         |
+======================+======================+======================+
| null                 | null                 | null                 |
+----------------------+----------------------+----------------------+
1 tuple
$ mclient -lsql -fsql -s'select NULL,NULL,NULL;' | wc -L
70



BUT:

Before (Jun2010):

$ mclient -lsql -fsql -s'select NULL,NULL,NULL;' -w80
+-------------------------+-------------------------+--------------------------+
| single_value            | single_value            | single_value             |
+=========================+=========================+==========================+
| null                    | null                    | null                     |
+-------------------------+-------------------------+--------------------------+
1 tuple
$ mclient -lsql -fsql -s'select NULL,NULL,NULL;' -w80 | wc -L
80


After (default):  

$ mclient -lsql -fsql -s'select NULL,NULL,NULL;' -w80
+-------------------------+-------------------------+--------------------------+
| single_value            | single_value            | single_value             |
+=========================+=========================+==========================+
| null                    | null                    | null                     |
+-------------------------+-------------------------+--------------------------+
1 tuple
$ mclient -lsql -fsql -s'select NULL,NULL,NULL;' -w80 | wc -L
80


in other words, also the semantics of terminal provided width ($COLUMNS) and
user provied width (-w) do differ now ...


Stefan


> > 
> > Stefan
> > > -                                 len[i] = 1 + (pagewidth - 2 - ((fields 
> > > * 3) - 1)) / fields;
> > 
> > ==                                  len[i] = 1 + (pagewidth - 1 - (fields * 
> > 3)) / fields;
> > ==                                  len[i] = 1 + (pagewidth - 1) / fields - 
> > 3;
> > 
> > ==                                  len[i] = (pagewidth - 1) / fields - 2;
> > 
> > ==                                  len[i] = (ws.ws_col - 1) / fields - 2;
> > 
> > > -                         }
> > > +                                 len[i] =  (pagewidth - ((fields * 3) - 
> > > 3)) / fields;
> > 
> > ==                                  len[i] =  (pagewidth + 3) / fields - 3;
> > 
> > ==                                  len[i] =  (ws.ws_col - 10 + 3) / fields 
> > - 3;
> > 
> > ==                                  len[i] =  (ws.ws_col - 7) / fields - 3;
> > 
> > > +                         } 
> > >                           if (len[i] < MINCOLSIZE)
> > >                                   len[i] = MINCOLSIZE;
> > >                           s = mapi_get_name(hdl, i);
> > > @@ -1256,7 +1256,7 @@
> > >           struct winsize ws;
> > >  
> > >           if (ioctl(fileno(stdin), TIOCGWINSZ, &ws) == 0 && ws.ws_col > 0)
> > > -                 pagewidth = ws.ws_col;
> > > +                 pagewidth = ws.ws_col - 10;  /* reserve some space for 
> > > sliders et al */
> _______________________________________________
> Checkin-list mailing list
> Checkin-list@monetdb.org
> http://mail.monetdb.org/mailman/listinfo/checkin-list

-- 
| Dr. Stefan Manegold | mailto:stefan.maneg...@cwi.nl |
| CWI,  P.O.Box 94079 | http://www.cwi.nl/~manegold/  |
| 1090 GB Amsterdam   | Tel.: +31 (20) 592-4212       |
| The Netherlands     | Fax : +31 (20) 592-4199       |
_______________________________________________
Checkin-list mailing list
Checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to