Signal-Cartel / EveScoutRescue

Web site and data tools for evescoutrescue.com, maintainer ThriceHappy.
https://evescoutrescue.com/home/
13 stars 10 forks source link

Adding static connection info to system page #228

Closed Klensor closed 4 years ago

Klensor commented 5 years ago

Required DB changes

new column for wh_systems table:

ALTER TABLE wh_systems ADD Statics VARCHAR(25) CHARACTER SET latin1 COLLATE latin1_general_ci NULL AFTER PlanetCount;

new table "wh types":

CREATE TABLE esrcuser.wh_types ( name VARCHAR(4) NOT NULL , static BOOLEAN NOT NULL , destination VARCHAR(10) NOT NULL , lifetime INT NULL , size INT NULL ) ENGINE = InnoDB CHARSET=utf8 COLLATE utf8_general_ci;

See attached Insert / Update scripts for data:

whStaticsDbData.zip

Klensor commented 5 years ago

Update: ignore previous db changes! Use this instead...

CREATE TABLE esrcuser.wh_systemstatics ( System VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, StaticType VARCHAR(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, PRIMARY KEY (System,StaticType) ) ENGINE = InnoDB;

klensor0307.zip

adeadparrot commented 5 years ago

I don't really like this. Not Klensor's fault. But the page already goes to the database twice for each system, for wh_info and for wh_tpe and now we add a third roundtrip to get wh_statics - This is a db structure issue right? should we not get all of this info (and more if we need it) in one single request?

I need to look at the database.

Orsel, Klensor, am I seeing this wrong?

bikerunner commented 5 years ago

From my point of view it's fine with three selects:

The current implementation with concat if more CPU intense than doing an extra select cost. This result can not be cached by the db server normally. And this adds a logical binding between code and database.

The extra select will be known (execution plan) and data is cached already by the db server. The round trip through the existing connection should not be an issue.

My shared hosters DB reports: Query took 0.0002 seconds. The query is: select * from wh_types types, wh_systemstatics statics where statics.System = 'J001694' and statics.StaticType = types.name;

@Klensor

Would be nive if @adeadparrot can respond before you change the PR.