>Hi, > >I take some rows from database (about 3?000?000 rows) with a query as >simple as this: > >Select * from Table where POSTAL_CODE = 84652 > >(Yes, I have an index upon this column. The column POSTAL_CODE is not >unique)
Try adding the PLAN statement into you query like; SELECT * FROM Table_Name WHERE POSTAL_CODE = 84652 PLAN (Table_Name INDEX (INDEX_NAME)) >FbCommand cmd = new FbCommand(); >cmd.CommandText = "Select * from Table where POSTAL_CODE = 84652"; >cmd.Connection = conn; >FbDataAdapter da = new FbDataAdapter(cmd); >da.Fill(dt); Are you filling a datatable or dataset? If you are filling a dataset and don't need a relational join, then try using a data table instead, like this. Datatable dt = new Datatable(); FbCommand cmd = new FbCommand(); cmd.CommandText = "Select * from YourTableName WHERE POSTAL_CODE = 84652 PLAN (YourTableName INDEX (NameOfYourIndex))"; cmd.Connection = conn; FbDataAdapter da = new FbDataAdapter(cmd); da.Fill(dt); >I'm waiting for aproximately 4 seconds, and that's too long. Yes, I >know, 3 000 000 rows, >It can be so long, but a program called "IBEasy+" gets the same result >with the same >Query in about, i don't know... a small part of one second :) Just I >call "Execute query" >And voila - I have my results. To further optimize this you may look into creating objects instead of data tables. Getting 3 million rows in 4 seconds is not to bad. Maybe you should look at how to reduce the amount of data being transferred over the wire, limit the columns coming back to you, or figure out a way to limit how much you are selecting at one time. It just seems like a lot of info to bring to the client. Steven Ramacher Hi, Thanks for advice. I see I came to the right place :) I get aboout 10000 rows In 4 seconds, but it's stall somehow slow. And I assume You are right, Without bigger optimizations I haven't got influence on this. My table contains three columns: ID WORD varchar(50) WORD_CODE (byte) I calculate WORD_CODE for every WORD. It's something like SOUNDEX code, but phonetical. And all I want to receive is a group of WORDS with the same WORD_CODE. In this way I receive words that are phonetically equal. I'm thinking about saving words within "tree structure" in database, but can't from this place come to conclusion if this will increase influence of Searching words with the same WORD_CODE. ------------------------------------------------------------------------ - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDE V _______________________________________________ Firebird-net-provider mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/firebird-net-provider ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Firebird-net-provider mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/firebird-net-provider
