c++ - Insert a row every given time else update previous row (Postgresql, PHP) -


i have multiple devices (eleven specific) sends information every second. information in recieved in apache server, parsed php script, stored in database , displayed in gui. doing right check if row teh current day exists, if doesn't create new one, otherwise update it. reason because need poll information database , display in c++ application make sort of real-time; if create row every time device send information, processing , reading data take significant ammount of time system resources (memory, cpu, etc..) making displaying of data not quite real-time. wrote report generation tool takes information every day (from 00:00:00 23:59:59) , put in excel spreadsheet.

my questions basically:

  • is posible insertion/updating part directly in database server or have logic in php script?

  • is there better (more efficient) way store information without decrease in performance in display device?

  • regarding report generation, if want sample intervals lets starting yesterday @ 15:50:00 , ending today @ 12:45:00 cannot done current data structure, need consider in order make data structure allow me create such queries.

the components use: - apache 2.4.4 - postgresql 9.2.3-2 - php 5.4.13

my recommendations - store information, devices sending. proper indexes , queries can process , retrieve information db fast.

for questions:

yes possible build logic desire inside postgres db using sql, pl/pgsql, pl/php, pl/java, pl/py , many other languages built postgres.

as said before - proper indexing can magic.

if cannot desired query speed full table - can create small table 1 row every device. , keep in table last known values show them in sort of real-time.


Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -