[Lazarus] data matrix with thousands of columns

Andrea Mauri andrea.mauri.75 at gmail.com
Tue Mar 26 21:22:26 CET 2013


>>
> If you think you'll be adding columns regularly, one solution that comes
> to my mind is this:
>
> 1) Create a "data_columns" table:
>
> create table data_columns(
>    idcolumn integer,
>    column_name varchar(20),
>    primary key(idcolumn));
>
> 2) Create the "data_rows" table:
>
> create table data_rows(
>    idrow integer,
>    idcolumn integer,
>    value varchar(100),
>    primary key(idrow)
> );
> alter table data_rows add constraint fk_idcolum foreign key(idcolumn)
> references data_columns(idcolumn);

I tried something like this but I have to insert millions of entries 
when application is running and this solution will slow enormously the app.
>

> 3) Then you can create the columns and add data to the "data_rows"
> database referencin to which column this "cell" is related.
>
> 4) To get the "spreadsheet", please read this:
>
> http://stackoverflow.com/questions/3002499/postgresql-crosstab-query
>
> Regards,
>





More information about the Lazarus mailing list