faster generation of obs-meta via indexes

This commit is contained in:
John Krauss 2016-07-12 10:42:00 -04:00
parent fe6343c73f
commit 897cf38d42
3 changed files with 218 additions and 180 deletions

View File

@ -93,95 +93,115 @@ with open('src/pg/test/fixtures/load_fixtures.sql', 'w') as outfile:
outfile.write(''' outfile.write('''
CREATE TABLE observatory.obs_meta AS ALTER TABLE observatory.obs_table
SELECT numer_c.id numer_id, ADD PRIMARY KEY (id);
denom_c.id denom_id, ALTER TABLE observatory.obs_column_table
geom_c.id geom_id, ADD PRIMARY KEY (column_id, table_id),
MAX(numer_c.name) numer_name, ADD FOREIGN KEY (column_id) REFERENCES observatory.obs_column(id) ON DELETE CASCADE,
MAX(denom_c.name) denom_name, ADD FOREIGN KEY (table_id) REFERENCES observatory.obs_table(id) ON DELETE CASCADE;
MAX(geom_c.name) geom_name, CREATE UNIQUE INDEX ON observatory.obs_column_table (table_id, colname);
MAX(numer_c.description) numer_description, ALTER TABLE observatory.obs_column
MAX(denom_c.description) denom_description, ADD PRIMARY KEY (id);
MAX(geom_c.description) geom_description, ALTER TABLE observatory.obs_column_to_column
MAX(numer_c.aggregate) numer_aggregate, ADD PRIMARY KEY (source_id, target_id, reltype),
MAX(denom_c.aggregate) denom_aggregate, ADD FOREIGN KEY (source_id) REFERENCES observatory.obs_column(id) ON DELETE CASCADE,
MAX(geom_c.aggregate) geom_aggregate, ADD FOREIGN KEY (target_id) REFERENCES observatory.obs_column(id) ON DELETE CASCADE;
MAX(numer_c.type) numer_type, ALTER TABLE observatory.obs_column_tag
MAX(denom_c.type) denom_type, ADD PRIMARY KEY (column_id, tag_id),
MAX(geom_c.type) geom_type, ADD FOREIGN KEY (column_id) REFERENCES observatory.obs_column(id) ON DELETE CASCADE,
MAX(numer_data_ct.colname) numer_colname, ADD FOREIGN KEY (tag_id) REFERENCES observatory.obs_tag(id) ON DELETE CASCADE;
MAX(denom_data_ct.colname) denom_colname, ALTER TABLE observatory.obs_tag
MAX(geom_geom_ct.colname) geom_colname, ADD PRIMARY KEY (id);
MAX(numer_geomref_ct.colname) numer_geomref_colname,
MAX(denom_geomref_ct.colname) denom_geomref_colname, CREATE TABLE observatory.obs_meta AS
MAX(geom_geomref_ct.colname) geom_geomref_colname, SELECT numer_c.id numer_id,
MAX(numer_t.tablename) numer_tablename, denom_c.id denom_id,
MAX(denom_t.tablename) denom_tablename, geom_c.id geom_id,
MAX(geom_t.tablename) geom_tablename, MAX(numer_c.name) numer_name,
MAX(numer_t.timespan) numer_timespan, MAX(denom_c.name) denom_name,
MAX(denom_t.timespan) denom_timespan, MAX(geom_c.name) geom_name,
MAX(numer_c.weight) numer_weight, MAX(numer_c.description) numer_description,
MAX(denom_c.weight) denom_weight, MAX(denom_c.description) denom_description,
MAX(geom_c.weight) geom_weight, MAX(geom_c.description) geom_description,
MAX(geom_t.timespan) geom_timespan, MAX(numer_c.aggregate) numer_aggregate,
MAX(geom_t.the_geom_webmercator)::geometry AS the_geom_webmercator, MAX(denom_c.aggregate) denom_aggregate,
ARRAY_AGG(DISTINCT s_tag.id) section_tags, MAX(geom_c.aggregate) geom_aggregate,
ARRAY_AGG(DISTINCT ss_tag.id) subsection_tags, MAX(numer_c.type) numer_type,
ARRAY_AGG(DISTINCT unit_tag.id) unit_tags MAX(denom_c.type) denom_type,
FROM observatory.obs_column_table numer_data_ct, MAX(geom_c.type) geom_type,
observatory.obs_table numer_t, MAX(numer_data_ct.colname) numer_colname,
observatory.obs_column_table numer_geomref_ct, MAX(denom_data_ct.colname) denom_colname,
observatory.obs_column geomref_c, MAX(geom_geom_ct.colname) geom_colname,
observatory.obs_column_to_column geomref_c2c, MAX(numer_geomref_ct.colname) numer_geomref_colname,
observatory.obs_column geom_c, MAX(denom_geomref_ct.colname) denom_geomref_colname,
observatory.obs_column_table geom_geom_ct, MAX(geom_geomref_ct.colname) geom_geomref_colname,
observatory.obs_column_table geom_geomref_ct, MAX(numer_t.tablename) numer_tablename,
observatory.obs_table geom_t, MAX(denom_t.tablename) denom_tablename,
observatory.obs_column_tag ss_ctag, MAX(geom_t.tablename) geom_tablename,
observatory.obs_tag ss_tag, MAX(numer_t.timespan) numer_timespan,
observatory.obs_column_tag s_ctag, MAX(denom_t.timespan) denom_timespan,
observatory.obs_tag s_tag, MAX(numer_c.weight) numer_weight,
observatory.obs_column_tag unit_ctag, MAX(denom_c.weight) denom_weight,
observatory.obs_tag unit_tag, MAX(geom_c.weight) geom_weight,
observatory.obs_column numer_c MAX(geom_t.timespan) geom_timespan,
LEFT JOIN ( MAX(geom_t.the_geom_webmercator)::geometry AS the_geom_webmercator,
observatory.obs_column_to_column denom_c2c ARRAY_AGG(DISTINCT s_tag.id) section_tags,
JOIN observatory.obs_column denom_c ON denom_c2c.target_id = denom_c.id ARRAY_AGG(DISTINCT ss_tag.id) subsection_tags,
JOIN observatory.obs_column_table denom_data_ct ON denom_data_ct.column_id = denom_c.id ARRAY_AGG(DISTINCT unit_tag.id) unit_tags
JOIN observatory.obs_table denom_t ON denom_data_ct.table_id = denom_t.id FROM observatory.obs_column_table numer_data_ct,
JOIN observatory.obs_column_table denom_geomref_ct ON denom_geomref_ct.table_id = denom_t.id observatory.obs_table numer_t,
) ON denom_c2c.source_id = numer_c.id observatory.obs_column_table numer_geomref_ct,
WHERE numer_c.id = numer_data_ct.column_id observatory.obs_column geomref_c,
AND numer_data_ct.table_id = numer_t.id observatory.obs_column_to_column geomref_c2c,
AND numer_t.id = numer_geomref_ct.table_id observatory.obs_column geom_c,
AND numer_geomref_ct.column_id = geomref_c.id observatory.obs_column_table geom_geom_ct,
AND geomref_c2c.reltype = 'geom_ref' observatory.obs_column_table geom_geomref_ct,
AND geomref_c.id = geomref_c2c.source_id observatory.obs_table geom_t,
AND geom_c.id = geomref_c2c.target_id observatory.obs_column_tag ss_ctag,
AND geom_geomref_ct.column_id = geomref_c.id observatory.obs_tag ss_tag,
AND geom_geomref_ct.table_id = geom_t.id observatory.obs_column_tag s_ctag,
AND geom_geom_ct.column_id = geom_c.id observatory.obs_tag s_tag,
AND geom_geom_ct.table_id = geom_t.id observatory.obs_column_tag unit_ctag,
AND geom_c.type ILIKE 'geometry' observatory.obs_tag unit_tag,
AND numer_c.type NOT ILIKE 'geometry' observatory.obs_column numer_c
AND numer_t.id != geom_t.id LEFT JOIN (
AND numer_c.id != geomref_c.id observatory.obs_column_to_column denom_c2c
AND unit_tag.type = 'unit' JOIN observatory.obs_column denom_c ON denom_c2c.target_id = denom_c.id
AND ss_tag.type = 'subsection' JOIN observatory.obs_column_table denom_data_ct ON denom_data_ct.column_id = denom_c.id
AND s_tag.type = 'section' JOIN observatory.obs_table denom_t ON denom_data_ct.table_id = denom_t.id
AND unit_ctag.column_id = numer_c.id JOIN observatory.obs_column_table denom_geomref_ct ON denom_geomref_ct.table_id = denom_t.id
AND unit_ctag.tag_id = unit_tag.id ) ON denom_c2c.source_id = numer_c.id
AND ss_ctag.column_id = numer_c.id WHERE numer_c.id = numer_data_ct.column_id
AND ss_ctag.tag_id = ss_tag.id AND numer_data_ct.table_id = numer_t.id
AND s_ctag.column_id = numer_c.id AND numer_t.id = numer_geomref_ct.table_id
AND s_ctag.tag_id = s_tag.id AND numer_geomref_ct.column_id = geomref_c.id
AND (denom_c2c.reltype = 'denominator' OR denom_c2c.reltype IS NULL) AND geomref_c2c.reltype = 'geom_ref'
AND (denom_geomref_ct.column_id = geomref_c.id OR denom_geomref_ct.column_id IS NULL) AND geomref_c.id = geomref_c2c.source_id
AND (denom_t.timespan = numer_t.timespan OR denom_t.timespan IS NULL) AND geom_c.id = geomref_c2c.target_id
GROUP BY numer_c.id, denom_c.id, geom_c.id, AND geom_geomref_ct.column_id = geomref_c.id
numer_t.id, denom_t.id, geom_t.id; AND geom_geomref_ct.table_id = geom_t.id
AND geom_geom_ct.column_id = geom_c.id
AND geom_geom_ct.table_id = geom_t.id
AND geom_c.type ILIKE 'geometry'
AND numer_c.type NOT ILIKE 'geometry'
AND numer_t.id != geom_t.id
AND numer_c.id != geomref_c.id
AND unit_tag.type = 'unit'
AND ss_tag.type = 'subsection'
AND s_tag.type = 'section'
AND unit_ctag.column_id = numer_c.id
AND unit_ctag.tag_id = unit_tag.id
AND ss_ctag.column_id = numer_c.id
AND ss_ctag.tag_id = ss_tag.id
AND s_ctag.column_id = numer_c.id
AND s_ctag.tag_id = s_tag.id
AND (denom_c2c.reltype = 'denominator' OR denom_c2c.reltype IS NULL)
AND (denom_geomref_ct.column_id = geomref_c.id OR denom_geomref_ct.column_id IS NULL)
AND (denom_t.timespan = numer_t.timespan OR denom_t.timespan IS NULL)
GROUP BY numer_c.id, denom_c.id, geom_c.id,
numer_t.id, denom_t.id, geom_t.id;
''') ''')
dropfiles.write(''' dropfiles.write('''
DROP TABLE IF EXISTS observatory.obs_meta DROP TABLE IF EXISTS observatory.obs_meta;
''') ''')

View File

@ -21,5 +21,4 @@ DROP TABLE IF EXISTS observatory.obs_d39f7fe5959891c8296490d83c22ded31c54af13;
DROP TABLE IF EXISTS observatory.obs_144e8b4f906885b2e057ac4842644a553ae49c6e; DROP TABLE IF EXISTS observatory.obs_144e8b4f906885b2e057ac4842644a553ae49c6e;
DROP TABLE IF EXISTS observatory.obs_c6fb99c47d61289fbb8e561ff7773799d3fcc308; DROP TABLE IF EXISTS observatory.obs_c6fb99c47d61289fbb8e561ff7773799d3fcc308;
DROP TABLE IF EXISTS observatory.obs_meta DROP TABLE IF EXISTS observatory.obs_meta;

View File

@ -25205,93 +25205,112 @@ cartodb_id,the_geom,the_geom_webmercator,geoid,aland,awater
140587,0106000020E610000001000000010300000001000000090000005187156EF98052C0594B0169FF4D44406B459BE3DC8052C07F4E417E364E4440213EB0E3BF8052C0AA0EB9196E4E44402DCF83BBB38052C0DBDD03745F4E44401570CFF3A78052C0D07AF832514E44404835ECF7C48052C0A5BA8097194E4440FDF2C98AE18052C0C1A6CEA3E24D44405D18E945ED8052C08B1A4CC3F04D44405187156EF98052C0594B0169FF4D4440,0106000020110F00000100000001030000000100000009000000BDFCFB423A6E5FC1405BF4E2C2E652415E6A32C8096E5FC17238A38200E7524104CEEC85D86D5FC1AADFE0B83EE752412BC595DFC36D5FC16588C5552EE75241627B1BDDAF6D5FC1FEE34F631EE7524187F38026E16D5FC1760D482DE0E65241753D8AAF116E5FC1BF2D58B3A2E65241E3F3A49C256E5FC1DA4D0F80B2E65241BDFCFB423A6E5FC1405BF4E2C2E65241,360470170002,75411,0 140587,0106000020E610000001000000010300000001000000090000005187156EF98052C0594B0169FF4D44406B459BE3DC8052C07F4E417E364E4440213EB0E3BF8052C0AA0EB9196E4E44402DCF83BBB38052C0DBDD03745F4E44401570CFF3A78052C0D07AF832514E44404835ECF7C48052C0A5BA8097194E4440FDF2C98AE18052C0C1A6CEA3E24D44405D18E945ED8052C08B1A4CC3F04D44405187156EF98052C0594B0169FF4D4440,0106000020110F00000100000001030000000100000009000000BDFCFB423A6E5FC1405BF4E2C2E652415E6A32C8096E5FC17238A38200E7524104CEEC85D86D5FC1AADFE0B83EE752412BC595DFC36D5FC16588C5552EE75241627B1BDDAF6D5FC1FEE34F631EE7524187F38026E16D5FC1760D482DE0E65241753D8AAF116E5FC1BF2D58B3A2E65241E3F3A49C256E5FC1DA4D0F80B2E65241BDFCFB423A6E5FC1405BF4E2C2E65241,360470170002,75411,0
\. \.
CREATE SCHEMA IF NOT EXISTS "observatory"; ALTER TABLE observatory.obs_table
ALTER TABLE "obs_c6fb99c47d61289fbb8e561ff7773799d3fcc308" SET SCHEMA "observatory"; ADD PRIMARY KEY (id);
CREATE TABLE observatory.obs_meta AS ALTER TABLE observatory.obs_column_table
SELECT numer_c.id numer_id, ADD PRIMARY KEY (column_id, table_id),
denom_c.id denom_id, ADD FOREIGN KEY (column_id) REFERENCES observatory.obs_column(id) ON DELETE CASCADE,
geom_c.id geom_id, ADD FOREIGN KEY (table_id) REFERENCES observatory.obs_table(id) ON DELETE CASCADE;
MAX(numer_c.name) numer_name, CREATE UNIQUE INDEX ON observatory.obs_column_table (table_id, colname);
MAX(denom_c.name) denom_name, ALTER TABLE observatory.obs_column
MAX(geom_c.name) geom_name, ADD PRIMARY KEY (id);
MAX(numer_c.description) numer_description, ALTER TABLE observatory.obs_column_to_column
MAX(denom_c.description) denom_description, ADD PRIMARY KEY (source_id, target_id, reltype),
MAX(geom_c.description) geom_description, ADD FOREIGN KEY (source_id) REFERENCES observatory.obs_column(id) ON DELETE CASCADE,
MAX(numer_c.aggregate) numer_aggregate, ADD FOREIGN KEY (target_id) REFERENCES observatory.obs_column(id) ON DELETE CASCADE;
MAX(denom_c.aggregate) denom_aggregate, ALTER TABLE observatory.obs_column_tag
MAX(geom_c.aggregate) geom_aggregate, ADD PRIMARY KEY (column_id, tag_id),
MAX(numer_c.type) numer_type, ADD FOREIGN KEY (column_id) REFERENCES observatory.obs_column(id) ON DELETE CASCADE,
MAX(denom_c.type) denom_type, ADD FOREIGN KEY (tag_id) REFERENCES observatory.obs_tag(id) ON DELETE CASCADE;
MAX(geom_c.type) geom_type, ALTER TABLE observatory.obs_tag
MAX(numer_data_ct.colname) numer_colname, ADD PRIMARY KEY (id);
MAX(denom_data_ct.colname) denom_colname,
MAX(geom_geom_ct.colname) geom_colname,
MAX(numer_geomref_ct.colname) numer_geomref_colname,
MAX(denom_geomref_ct.colname) denom_geomref_colname,
MAX(geom_geomref_ct.colname) geom_geomref_colname,
MAX(numer_t.tablename) numer_tablename,
MAX(denom_t.tablename) denom_tablename,
MAX(geom_t.tablename) geom_tablename,
MAX(numer_t.timespan) numer_timespan,
MAX(denom_t.timespan) denom_timespan,
MAX(numer_c.weight) numer_weight,
MAX(denom_c.weight) denom_weight,
MAX(geom_c.weight) geom_weight,
MAX(geom_t.timespan) geom_timespan,
MAX(geom_t.the_geom_webmercator)::geometry AS the_geom_webmercator,
ARRAY_AGG(DISTINCT s_tag.id) section_tags,
ARRAY_AGG(DISTINCT ss_tag.id) subsection_tags,
ARRAY_AGG(DISTINCT unit_tag.id) unit_tags
FROM observatory.obs_column_table numer_data_ct,
observatory.obs_table numer_t,
observatory.obs_column_table numer_geomref_ct,
observatory.obs_column geomref_c,
observatory.obs_column_to_column geomref_c2c,
observatory.obs_column geom_c,
observatory.obs_column_table geom_geom_ct,
observatory.obs_column_table geom_geomref_ct,
observatory.obs_table geom_t,
observatory.obs_column_tag ss_ctag,
observatory.obs_tag ss_tag,
observatory.obs_column_tag s_ctag,
observatory.obs_tag s_tag,
observatory.obs_column_tag unit_ctag,
observatory.obs_tag unit_tag,
observatory.obs_column numer_c
LEFT JOIN (
observatory.obs_column_to_column denom_c2c
JOIN observatory.obs_column denom_c ON denom_c2c.target_id = denom_c.id
JOIN observatory.obs_column_table denom_data_ct ON denom_data_ct.column_id = denom_c.id
JOIN observatory.obs_table denom_t ON denom_data_ct.table_id = denom_t.id
JOIN observatory.obs_column_table denom_geomref_ct ON denom_geomref_ct.table_id = denom_t.id
) ON denom_c2c.source_id = numer_c.id
WHERE numer_c.id = numer_data_ct.column_id
AND numer_data_ct.table_id = numer_t.id
AND numer_t.id = numer_geomref_ct.table_id
AND numer_geomref_ct.column_id = geomref_c.id
AND geomref_c2c.reltype = 'geom_ref'
AND geomref_c.id = geomref_c2c.source_id
AND geom_c.id = geomref_c2c.target_id
AND geom_geomref_ct.column_id = geomref_c.id
AND geom_geomref_ct.table_id = geom_t.id
AND geom_geom_ct.column_id = geom_c.id
AND geom_geom_ct.table_id = geom_t.id
AND geom_c.type ILIKE 'geometry'
AND numer_c.type NOT ILIKE 'geometry'
AND numer_t.id != geom_t.id
AND numer_c.id != geomref_c.id
AND unit_tag.type = 'unit'
AND ss_tag.type = 'subsection'
AND s_tag.type = 'section'
AND unit_ctag.column_id = numer_c.id
AND unit_ctag.tag_id = unit_tag.id
AND ss_ctag.column_id = numer_c.id
AND ss_ctag.tag_id = ss_tag.id
AND s_ctag.column_id = numer_c.id
AND s_ctag.tag_id = s_tag.id
AND (denom_c2c.reltype = 'denominator' OR denom_c2c.reltype IS NULL)
AND (denom_geomref_ct.column_id = geomref_c.id OR denom_geomref_ct.column_id IS NULL)
AND (denom_t.timespan = numer_t.timespan OR denom_t.timespan IS NULL)
GROUP BY numer_c.id, denom_c.id, geom_c.id,
numer_t.id, denom_t.id, geom_t.id;
CREATE SCHEMA IF NOT EXISTS "observatory";
ALTER TABLE "obs_c6fb99c47d61289fbb8e561ff7773799d3fcc308" SET SCHEMA "observatory";
CREATE TABLE observatory.obs_meta AS
SELECT numer_c.id numer_id,
denom_c.id denom_id,
geom_c.id geom_id,
MAX(numer_c.name) numer_name,
MAX(denom_c.name) denom_name,
MAX(geom_c.name) geom_name,
MAX(numer_c.description) numer_description,
MAX(denom_c.description) denom_description,
MAX(geom_c.description) geom_description,
MAX(numer_c.aggregate) numer_aggregate,
MAX(denom_c.aggregate) denom_aggregate,
MAX(geom_c.aggregate) geom_aggregate,
MAX(numer_c.type) numer_type,
MAX(denom_c.type) denom_type,
MAX(geom_c.type) geom_type,
MAX(numer_data_ct.colname) numer_colname,
MAX(denom_data_ct.colname) denom_colname,
MAX(geom_geom_ct.colname) geom_colname,
MAX(numer_geomref_ct.colname) numer_geomref_colname,
MAX(denom_geomref_ct.colname) denom_geomref_colname,
MAX(geom_geomref_ct.colname) geom_geomref_colname,
MAX(numer_t.tablename) numer_tablename,
MAX(denom_t.tablename) denom_tablename,
MAX(geom_t.tablename) geom_tablename,
MAX(numer_t.timespan) numer_timespan,
MAX(denom_t.timespan) denom_timespan,
MAX(numer_c.weight) numer_weight,
MAX(denom_c.weight) denom_weight,
MAX(geom_c.weight) geom_weight,
MAX(geom_t.timespan) geom_timespan,
MAX(geom_t.the_geom_webmercator)::geometry AS the_geom_webmercator,
ARRAY_AGG(DISTINCT s_tag.id) section_tags,
ARRAY_AGG(DISTINCT ss_tag.id) subsection_tags,
ARRAY_AGG(DISTINCT unit_tag.id) unit_tags
FROM observatory.obs_column_table numer_data_ct,
observatory.obs_table numer_t,
observatory.obs_column_table numer_geomref_ct,
observatory.obs_column geomref_c,
observatory.obs_column_to_column geomref_c2c,
observatory.obs_column geom_c,
observatory.obs_column_table geom_geom_ct,
observatory.obs_column_table geom_geomref_ct,
observatory.obs_table geom_t,
observatory.obs_column_tag ss_ctag,
observatory.obs_tag ss_tag,
observatory.obs_column_tag s_ctag,
observatory.obs_tag s_tag,
observatory.obs_column_tag unit_ctag,
observatory.obs_tag unit_tag,
observatory.obs_column numer_c
LEFT JOIN (
observatory.obs_column_to_column denom_c2c
JOIN observatory.obs_column denom_c ON denom_c2c.target_id = denom_c.id
JOIN observatory.obs_column_table denom_data_ct ON denom_data_ct.column_id = denom_c.id
JOIN observatory.obs_table denom_t ON denom_data_ct.table_id = denom_t.id
JOIN observatory.obs_column_table denom_geomref_ct ON denom_geomref_ct.table_id = denom_t.id
) ON denom_c2c.source_id = numer_c.id
WHERE numer_c.id = numer_data_ct.column_id
AND numer_data_ct.table_id = numer_t.id
AND numer_t.id = numer_geomref_ct.table_id
AND numer_geomref_ct.column_id = geomref_c.id
AND geomref_c2c.reltype = 'geom_ref'
AND geomref_c.id = geomref_c2c.source_id
AND geom_c.id = geomref_c2c.target_id
AND geom_geomref_ct.column_id = geomref_c.id
AND geom_geomref_ct.table_id = geom_t.id
AND geom_geom_ct.column_id = geom_c.id
AND geom_geom_ct.table_id = geom_t.id
AND geom_c.type ILIKE 'geometry'
AND numer_c.type NOT ILIKE 'geometry'
AND numer_t.id != geom_t.id
AND numer_c.id != geomref_c.id
AND unit_tag.type = 'unit'
AND ss_tag.type = 'subsection'
AND s_tag.type = 'section'
AND unit_ctag.column_id = numer_c.id
AND unit_ctag.tag_id = unit_tag.id
AND ss_ctag.column_id = numer_c.id
AND ss_ctag.tag_id = ss_tag.id
AND s_ctag.column_id = numer_c.id
AND s_ctag.tag_id = s_tag.id
AND (denom_c2c.reltype = 'denominator' OR denom_c2c.reltype IS NULL)
AND (denom_geomref_ct.column_id = geomref_c.id OR denom_geomref_ct.column_id IS NULL)
AND (denom_t.timespan = numer_t.timespan OR denom_t.timespan IS NULL)
GROUP BY numer_c.id, denom_c.id, geom_c.id,
numer_t.id, denom_t.id, geom_t.id;