Impressum   

pgv_dates

Beschreibung

Struktur

AttributNullable?Datentyp
d_dayJaint(11)
d_monthJavarchar(5)
d_monJaint(11)
d_yearJaint(11)
d_datestampJaint(11)
d_julianday1Jaint(11)
d_julianday2Jaint(11)
d_factJavarchar(15)
d_gidJavarchar(20)
d_fileJasmallint(5) unsigned
d_typeJavarchar(13)

Indizes

NameTypAttribute
pgv_date_dayIndexd_day
pgv_date_monthIndexd_month
pgv_date_monIndexd_mon
pgv_date_yearIndexd_year
pgv_date_datestampIndexd_datestamp
pgv_date_julianday1Indexd_julianday1
pgv_date_julianday2Indexd_julianday2
pgv_date_gidIndexd_gid
pgv_date_fileIndexd_file
pgv_date_typeIndexd_type
pgv_date_fact_gidIndexd_fact
d_gid

Anmerkungen

Diese Tabelle hat kein PRIMARY Index, da einige Events zweimal zu einer Person oder Familie registiert werden können.

Ansonsten scheint mir die Tabelle mit unnötigen, nicht ausreichend selektivien Indexes überhäuft zu sein.

Langläufer

SELECT death.d_gid AS id, death.d_julianday2-birth.d_julianday1 AS age
  FROM pgv_dates AS death, pgv_dates AS birth, pgv_individuals AS indi
 WHERE indi.i_id=birth.d_gid
   AND birth.d_gid=death.d_gid
   AND death.d_file=1
   AND birth.d_file=death.d_file
   AND birth.d_file=indi.i_file
   AND birth.d_fact IN ('BIRT', 'CHR', 'BAPM', '_BRTM')
   AND death.d_fact IN ('DEAT', 'BURI', 'CREM')
   AND birth.d_julianday1!=0
   AND death.d_julianday1!=0
   AND 1=1
 ORDER BY age DESC LIMIT 0, 1
;

Diese Abfrage berechnet die älteste Person.