Summary: | ASTERISK-16134: [patch] long waiting (over 2 min) for cdr_tds running "SELECT 1 FROM cdr" when asterisk starting with aournd 3mil cdr in table | ||
Reporter: | K K Wong (kkwong) | Labels: | |
Date Opened: | 2010-05-24 06:27:43 | Date Closed: | 2010-06-08 10:45:58 |
Priority: | Minor | Regression? | No |
Status: | Closed/Complete | Components: | CDR/cdr_tds |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) issue17380-01.patch | |
Description: | we are testing asterisk 1.4.31 to replace old 1.2x box, when start then new 1.4.31 box with "asterisk -cvvvv" it stop at "== Parsing '/etc/asterisk/cdr_tds.conf': Found" for more then 2 min and from sql profiler shows it running the query "SELECT 1 FROM cdr" ****** ADDITIONAL INFORMATION ****** OS : CentOS 5.2 up to date freetds-0.64-1 UnixODBC-2.2.11-7.1 asterisk install via yum repo CDR storage : MSSQL2000 CDR size : around 3,000,000 cdr in table | ||
Comments: | By: Jason Parker (jparker) 2010-05-24 11:56:26 Good old MSSQL.. I remember running into this problem years ago. We used a very similar query (SELECT 1 FROM somemassivetable), and it took a very long time. It *may* help to add an index to that table. It may not use it though, since there is no WHERE clause. By: K K Wong (kkwong) 2010-05-24 22:03:26 1. the table already have index on "start" field. 2. tested same statement (SELECT 1 FROM somemassivetable) in oracle 9i with same result that took a very long time. 3. tested same statement (SELECT 1 FROM somemassivetable) in mySQL 5.0.22 with same result that took a very long time. By: Sean Bright (seanbright) 2010-06-03 08:40:42 Could you try the attached patch and report your results? By: K K Wong (kkwong) 2010-06-04 05:57:58 tested with the patch now asterisk takes 1 sec to start even the db have 3mil cdr, thx By: Digium Subversion (svnbot) 2010-06-08 10:28:49 Repository: asterisk Revision: 269006 U branches/1.4/cdr/cdr_tds.c ------------------------------------------------------------------------ r269006 | seanbright | 2010-06-08 10:28:48 -0500 (Tue, 08 Jun 2010) | 11 lines Reduce startup time for cdr_tds with large CDR tables. Since we are just checking for table existence, add a WHERE clause that will return no rows but will raise an error if the table doesn't exist. (closes issue ASTERISK-16134) Reported by: kkwong Patches: issue17380-01.patch uploaded by seanbright (license 71) Tested by: kkwong ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=269006 By: Digium Subversion (svnbot) 2010-06-08 10:39:52 Repository: asterisk Revision: 269007 _U trunk/ U trunk/cdr/cdr_tds.c ------------------------------------------------------------------------ r269007 | seanbright | 2010-06-08 10:39:52 -0500 (Tue, 08 Jun 2010) | 18 lines Merged revisions 269006 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r269006 | seanbright | 2010-06-08 11:28:49 -0400 (Tue, 08 Jun 2010) | 11 lines Reduce startup time for cdr_tds with large CDR tables. Since we are just checking for table existence, add a WHERE clause that will return no rows but will raise an error if the table doesn't exist. (closes issue ASTERISK-16134) Reported by: kkwong Patches: issue17380-01.patch uploaded by seanbright (license 71) Tested by: kkwong ........ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=269007 By: Digium Subversion (svnbot) 2010-06-08 10:45:57 Repository: asterisk Revision: 269010 _U branches/1.6.2/ U branches/1.6.2/cdr/cdr_tds.c ------------------------------------------------------------------------ r269010 | seanbright | 2010-06-08 10:45:57 -0500 (Tue, 08 Jun 2010) | 25 lines Merged revisions 269007 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ................ r269007 | seanbright | 2010-06-08 11:39:52 -0400 (Tue, 08 Jun 2010) | 18 lines Merged revisions 269006 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r269006 | seanbright | 2010-06-08 11:28:49 -0400 (Tue, 08 Jun 2010) | 11 lines Reduce startup time for cdr_tds with large CDR tables. Since we are just checking for table existence, add a WHERE clause that will return no rows but will raise an error if the table doesn't exist. (closes issue ASTERISK-16134) Reported by: kkwong Patches: issue17380-01.patch uploaded by seanbright (license 71) Tested by: kkwong ........ ................ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=269010 |