Ich versuche, eine Datenbank mit pgAdmin3 zu konsultieren, und ich muss Tabellen beitreten. Ich verwende den folgenden Code ein:postgres innere JOIN Abfrage nicht genügend Speicher
SELECT table1.species, table1.trait, table1.value, table1.units, table2.id, table2.family, table2.latitude, table2.longitude, table2.species as speciescheck
FROM table1 INNER JOIN table2
ON table1.species = table2.species
Aber ich immer laufen diese Fehlermeldung:
an out of memory error
Also habe ich versucht, mein Ergebnis in einer neuen Tabelle einzufügen, wie folgt:
CREATE TABLE new_table AS
SELECT table1.species, table1.trait, table1.value, table1.units, table2.id, table2.family, table2.latitude, table2.longitude, table2.species as speciescheck
FROM table1 INNER JOIN table2
ON table1.species = table2.species
Und bekam noch einen Fehler:
ERROR: could not extend file "base/17675/43101.15": No space left on device
SQL state: 53100
Hint: Check free disk space.
Ich bin sehr, sehr neu in diesem (ist das erste Mal, dass ich mit PostgreSQL umgehen muss) und ich denke, ich kann etwas tun, um diese Abfrage zu optimieren und diese Art von Fehler zu vermeiden. Ich habe keine Privilegien in der Datenbank. Kann jemand helfen?? Vielen Dank im Voraus!
Aktualisiert: Tabelle 1 Beschreibung
-- Table: table1
-- DROP TABLE table1;
CREATE TABLE table1
(
species character varying(100),
trait character varying(50),
value double precision,
units character varying(50)
)
WITH (
OIDS=FALSE
);
ALTER TABLE table1
OWNER TO postgres;
GRANT ALL ON TABLE table1 TO postgres;
GRANT SELECT ON TABLE table1 TO banco;
-- Index: speciestable1_idx
-- DROP INDEX speciestable1_idx;
CREATE INDEX speciestable1_idx
ON table1
USING btree
(species COLLATE pg_catalog."default");
-- Index: traittype_idx
-- DROP INDEX traittype_idx;
CREATE INDEX traittype_idx
ON table1
USING btree
(trait COLLATE pg_catalog."default");
und table2 als:
-- Table: table2
-- DROP TABLE table2;
CREATE TABLE table2
(
id integer NOT NULL,
family character varying(40),
species character varying(100),
plotarea real,
latitude double precision,
longitude double precision,
source integer,
latlon geometry,
CONSTRAINT table2_pkey PRIMARY KEY (id)
)
WITH (
OIDS=FALSE
);
ALTER TABLE table2
OWNER TO postgres;
GRANT ALL ON TABLE table2 TO postgres;
GRANT SELECT ON TABLE table2 TO banco;
-- Index: latlon_gist
-- DROP INDEX latlon_gist;
CREATE INDEX latlon_gist
ON table2
USING gist
(latlon);
-- Index: species_idx
-- DROP INDEX species_idx;
CREATE INDEX species_idx
ON table2
USING btree
(species COLLATE pg_catalog."default");
Diese Frage ist ohne die Tabellendefinitionen nicht zu beantworten. Was ist "Spezies"? Ist es * mindestens * ein natürlicher Schlüssel an einem der beiden Tische? – wildplasser