php - MySQL Table with frequent TRUNCATE, UPDATE, & SELECT -


i building application requires mysql table emptied , refilled fresh data every minute. @ same time, expected table receive anywhere 10-15 select statements per second constantly. select statements should in general fast (selecting 10-50 medium length strings every time). few things i'm worried about:

is there potential select query run in between truncate , update queries return 0 rows? need lock table when executing truncate-update query pair?

are there significant performance issues should worry regarding setup?

there propably better way achieve goal. here's possible answer question anyway: can encapsulate queries meant executed in transaction. off top of head like

begin transaction; truncate foo; insert foo ...; commit; 

edit: above part plain wrong, see philip devine's comment. thanks.

regarding performance question: repeatedly connecting server can costly. if have persistent connection, should fine. can save little bits here , there executing multiple queries in batch or using prepared statements.


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -