insert ข้อมูลทีละมากๆ แล้ว time out แก้ยังไงคะ
Moderators: mindphp, ผู้ดูแลกระดาน
-
- PHP Super Member
- Posts: 250
- Joined: 02/06/2014 9:55 am
insert ข้อมูลทีละมากๆ แล้ว time out แก้ยังไงคะ
insert ข้อมูลทีละมากๆ แล้ว time out ทำให้ข้อมูลมาไม่ครบ แก้ยังไงคะ
- mindphp
- ผู้ดูแลระบบ MindPHP
- Posts: 27167
- Joined: 22/09/2008 6:18 pm
- Contact:
Re: insert ข้อมูลทีละมากๆ แล้ว time out แก้ยังไงคะ
ตัดเป็น ช่วงๆ ดูตามปริมาณ field และข้อมูล
อาจจะตัดเป็น ช่วงละ 100 insert ทีหนึ่ง
อาจจะตัดเป็น ช่วงละ 100 insert ทีหนึ่ง
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
-
- PHP Super Member
- Posts: 250
- Joined: 02/06/2014 9:55 am
Re: insert ข้อมูลทีละมากๆ แล้ว time out แก้ยังไงคะ
ตัดเป็นช่วงๆ ทำยังไงคะ มีตัวอย่างให้ดูมั้ยคะ
- jataz2
- PHP Super Member
- Posts: 255
- Joined: 22/02/2011 11:48 am
Re: insert ข้อมูลทีละมากๆ แล้ว time out แก้ยังไงคะ
วิธีเเก้ query timeout มีหลายวธีครับ เเต่เอาที่ง่ายสุด ไม่ต้องเเก้ code ใดๆเลยคือ
ขยายเวลา timeout ให้นานขึ้น ที่ web.config เข้าไปเพิ่ม Connection Timeout ใน connection string ได้เลยครับ หน่วยเป็น วินาที ในตัวอย่างคือ query จะ timeout หากเกิน 30 วินาที
Data Source=(local);Initial Catalog=AdventureWorks;Integrated Security=SSPI;Connection Timeout=30;
ขยายเวลา timeout ให้นานขึ้น ที่ web.config เข้าไปเพิ่ม Connection Timeout ใน connection string ได้เลยครับ หน่วยเป็น วินาที ในตัวอย่างคือ query จะ timeout หากเกิน 30 วินาที
Data Source=(local);Initial Catalog=AdventureWorks;Integrated Security=SSPI;Connection Timeout=30;
- jataz2
- PHP Super Member
- Posts: 255
- Joined: 22/02/2011 11:48 am
Re: insert ข้อมูลทีละมากๆ แล้ว time out แก้ยังไงคะ
อีกวิธีคือ เอา query การ insert นำไปสร้างเป็น store procedure ไว้ครับ เเล้วส่ง parameter เข้าไปเมื่อจะ insert ข้อมูล วิธีนี้ ช่วยได้นิดหน่อยครับ เพราะลดเวลาการเช็คไวยกรณ์ของของ query การ Insert ให้น้อยลงเพราะถูก verify เเล้วเมื่อครั้งสร้าง store procedure
-
- Similar Topics
- Replies
- Views
- Last post
-
-
c# insert ข้อมูลที่ละมากๆ โดยไม่ใช้การ insert into
by jataz2 » 25/11/2016 4:20 pm » in Programming - C/C++ & java & Python - 0 Replies
- 934 Views
-
Last post by jataz2
25/11/2016 4:20 pm
-
-
- 3 Replies
- 333 Views
-
Last post by M034
03/05/2016 3:46 pm
-
-
รับสมัคร ที่ปรึกษาโปรแกรมบัญชี [เลือกวันทำงานได้ / Full-Time Part-Time]
by น้องชะอมชุบไข่ » 08/12/2014 10:07 pm » in พูดคุยเรื่องทั่วไป จับฉ่าย - 2 Replies
- 7200 Views
-
Last post by น้องชะอมชุบไข่
13/12/2015 10:48 pm
-
-
-
ถ้าจะเขียน SQL Insert เเล้วไม่ให้มัน Insert ซ้ำในคำสั่งเดียว จะเขียนได้ยังไงค่ะ
by thatsawan » 21/10/2016 2:37 pm » in SQL - Database - 1 Replies
- 1931 Views
-
Last post by mindphp
21/10/2016 2:45 pm
-
Who is online
Users browsing this forum: Google [Bot] and 8 guests