Mobile app version of vmapp.org
Login or Join
Kaufman445

: What method should I use for copying data from one table to another one? I'm wondering what method I should use for copying data from one table to another one. I'm letting users post data

@Kaufman445

Posted in: #Cron #Database #Php #Script

I'm wondering what method I should use for copying data from one table to another one. I'm letting users post data through a form which uses table1 to save data. Now for displaying results I use data from table2 but I also need some data from table1.


Method 1: Copy the needed data on pageload, when the user executes it. Might get slower, but uses live data.
Method 2: Use a cronjob. Less resources, but not live data


I'm interested in how much this will affect the speed of the website.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Kaufman445

1 Comments

Sorted by latest first Latest Oldest Best

 

@Bryan171

Depends on the amount of data.

If:


No large/weird/complex queries
No large datasets
Rowlocking (innoDB) instead of tablelocking (MyISAM)
No absurt amount of users/pagehits


Then you have no problem at all. Just make sure you index the right columns, and cleanup what you can so you dont get redundent data. If you're not sure when you should consider something 'a large dataset', you're not using a large dataset.

Easy answer: Just try and you'll see :).
But to my experience, the most influention factor is the queries themselves, just make sure those are right.



If you are talking about duplicating data, then please stop doing that! You can select info from two tables without ANY problem. Just use two queries, or a join.

Duplicate data is a big no-no in databases. 1 small column might provide a handy solution sometime, but always try the best you can to avoid it. This is a part of database normalisation.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme