[how to] I want to know the defference between using varchar(100) and varchar(255)? |
- I want to know the defference between using varchar(100) and varchar(255)?
- How to check for mutiple rows with same data?
- What is the difference between optimize table and analyze table in mysql
- Select multiple columns into a single output column
- mysql alternative to prepared statements in triggers
- Maintenance in MYSQL when innodb_file_per_table disabled
- Does disabling index exists in a table?
- Why would I NOT use the SQL Server option "optimize for ad hoc workloads"?
- Display user-defined types and their details
- Is there a sortable ('order by') alternative to CURRENT_TIMESTAMP
- Suggestion for storing a lot of simple data
- slow queries - set weight to token type in tsquery - postgresql
- Special ordering
- What are the advantages of a database design with single table for MtM relationships?
- Why is SQL Server memory showing in task manager
- Is it possible to pipe the result of a mysqldump straight to rsync as the source argument?
- How to solve index missing problem in one table, while other table of same property does not produce any error?
- Is data retrieved from SQL Server compressed for transmission?
- Can this array group count query be improved?
- Oracle 10g slow performance on first query
- MySQL Workbench sync keeps requesting the same changes
- Getting max values from MySQL tables
- Rules in SQL Server 2005
- FLUSH TABLES stays in the processlist even after execution
- SQL Server Analysis Studio naive Bayes attribute has too many states
- How could DBAs be more 'programmer friendly'?
I want to know the defference between using varchar(100) and varchar(255)? Posted: 26 Feb 2013 08:17 PM PST I want to know defferents between varchar(100) and varchar(255) in terms of memory usege and programming problem of using more memory please help me |
How to check for mutiple rows with same data? Posted: 26 Feb 2013 08:11 PM PST Hi all can anyone advise how do i check mutiple rows with same data? E.g. i have 2 rows with following values: Cola Colb Colc TYPE_APPLE 123 abc Colb Colb Colc TYPE_APPLE 123 abc I want to write an sql query which will not select data of mutiple rows which contain the same data as above. How should i write the query? |
What is the difference between optimize table and analyze table in mysql Posted: 26 Feb 2013 07:33 PM PST What is the difference between optimize table and analyze table in mysql? I have read the online docs, but not sure what the difference is. |
Select multiple columns into a single output column Posted: 26 Feb 2013 04:19 PM PST I have the following query that sort of works, but I find it to be kludgy and inefficient, and it outputs blobs for most of the data fields which isn't what I want. I know this is a bit of an odd query, else I would probably have found some advice when searching, but it is necessary for our business logic. We've been doing this in Hibernate queries and using software to output the file but we're needing to improve performance drastically and that means using raw sql. The output of this query is to be used to partially populate a helper table that we query to figure out which of our 40-odd product tables a particular item is contained in. Could the following query be replicated using something like Input looks like the following table: | PN1 | PN2 | PN3 | PN4 | MFG | TableId | OtherData | ----------------------------------------------------------------------- | asdf | abde | 12354 | asdfc | 2 | 26 | 0.2456 | | nupo | 1354 | null | null | 2 | 26 | 1.53 | | ... | ... | ... | ... | ... | ... | ... | | ... | ... | ... | ... | ... | ... | ... | | ... | ... | ... | ... | ... | ... | ... | I want the output .dat file to look like this: "Pn","Mfg","TableId","SourceColumn","OtherData" "asdf",2,26,"PN1",0.2456 "abde",2,26,"PN2",0.2456 "12354",2,26,"PN3",0.2456 "asdfc",2,26,"PN4",0.2456 "nupo",2,26,"PN1",1.53 "1354",2,26,"PN2",1.53 ... ... ... However, what I currently get looks like this: | Pn | Mfg | TableId | SourceColumn | OtherData | ----------------------------------------------------------------- | "Pn" | {blob} | "TableId" | "PN" | {blob} | | "asdf" | {blob} | "PN1" | "PN1" | {blob} | | "abde" | {blob} | "PN2" | "PN2" | {blob} | | "12354" | {blob} | "PN3" | "PN3" | {blob} | | "asdfc" | {blob} | "PN4" | "PN4" | {blob} | | "nupo" | {blob} | "PN1" | "PN1" | {blob} | | "1354" | {blob} | "PN2" | "PN2" | {blob} | | ... | ... | ... | ... | ... | | ... | ... | ... | ... | ... | | ... | ... | ... | ... | ... | |
mysql alternative to prepared statements in triggers Posted: 26 Feb 2013 02:11 PM PST I'm trying to get some stored procedures to fire from a MySQL 5.1 trigger. When these were called without triggers, I used prepare and execute statements to build queries and other SQL calls. I have a servies of statements like these: select concat("select ", $var1, " from ". $var2, " where col1 = ", $var3) into @sql; prepare s1 from @sql; execute s1; Clearly that approach won't work with code involved in a trigger as prepared statements aren't allowed in triggers or the procedures they call. I'm looking for some alternative ideas about how to build statements like these and execute them without using dynamic SQL. I've thought about nested case statements and similar structures, but $var1 and $var3 could have any of hundreds of values. Has anyone found a way to do this? Googling hasn't been much help. |
Maintenance in MYSQL when innodb_file_per_table disabled Posted: 26 Feb 2013 01:04 PM PST I have read your post and I completely understand OPTIMIZE TABLE to perform in an environment where innodb_file_per_table is disabled, does not shrink the global ibdata1 tablespace. But what if I need to perform index maintenance on InnoDB tables with ANALYZE command, it will grow the single tablespace also? What other alternatives are there to increase performance or doing some maintenance in Innodb engine, when using a single tablespace and without grow out of control the single ibdata1. Regards. Matthew |
Does disabling index exists in a table? Posted: 26 Feb 2013 12:00 PM PST So I have a script that runs daily. It creates a temp table then inserts the records to a table from the temp table. The script used to create indexes but few months ago I commented out the index creation. My question is, does the index still exist in the table? Will it still slow down the update, insert etc? I can see the index names in the index usage report. |
Why would I NOT use the SQL Server option "optimize for ad hoc workloads"? Posted: 26 Feb 2013 11:34 AM PST I've been reading some great articles regarding SQL Server plan caching by Kimberly Tripp such as this one: http://www.sqlskills.com/blogs/kimberly/plan-cache-and-optimizing-for-adhoc-workloads/ Why is there even an option to "optimize for ad hoc workloads"? Shouldn't this always be on? Whether the developers are using ad-hoc SQL or not, why would you not have this option enabled on every instance that supports it (SQL 2008+), thereby reducing cache bloat? |
Display user-defined types and their details Posted: 26 Feb 2013 07:28 PM PST I've created a few new UDTs in PostgreSQL. However, now I have two problems:
Unfortunately, I couldn't find anything on that in the PostgreSQL documentation. |
Is there a sortable ('order by') alternative to CURRENT_TIMESTAMP Posted: 26 Feb 2013 06:43 PM PST I'm in the process of looking for a way to find a sortable alternative to a column that is populated with CURRENT_TIMESTAMP and I'm stumped at the moment. I have a web based form with multiple fields including a field that is hidden on the form that writes the CURRENT_TIMESTAMP to the database when the form is submitted. The challenge I'm facing is that I want to create reports from these forms (sorting by month, week, or year) and order them by the timestamp but based on what I've seen here, sorting is not possible. Is there an alternative I can use to achieve the results I want? |
Suggestion for storing a lot of simple data Posted: 26 Feb 2013 11:56 AM PST I'm looking to crawl a lot of webpages (500,000,000,000) records and be able to store the linking structure for a later date. The way I planned on laying out the database was as follows: 2 Tables Table: Pages Table: Links Basically I'll be able to see what webpages link to where recurrently/several levels deep per website. I want to map a large network of websites and their linking patterns. So I need to know if there is a better way of doing so, and maybe some suggestions on how to design the database structure/system. I was planning on PostgreSQL to start with since I've used it some, but with this amount of data I'm open to anything. |
slow queries - set weight to token type in tsquery - postgresql Posted: 26 Feb 2013 04:33 PM PST Postgresql version 9.2.3! I'm working on a database for mapping of chemical names. My main table contains aprox 91 million records and it's indexed by gin. I want to query it with multiple names (I'm trying now with 100 entries), which I first put in a query table, create a tsquery column of the names and index it with gist. Main table structure: I was trying different approaches, thus for testing gin index I created a clone: then: The query table is: Same as in the main table, I fill it in with COPY from via a temp table and then I add the tsquery column: The query is basically a join between both tables: lexemes is the gist indexed tsquery column on my query table, whereas tsv_syns is the gin indexed tsvector column in the main names table, the one with 91 million records. The query is intended to match names, exact matches if possible. It works very well for such a large table. Normal names, containing only characters, can be retreated even in microseconds. The problem is when the string names contains numbers. The operation tsvector and tsquery create one token for each number, and all together makes the query for this sort of entries rather slow, well, slower. Instead of a few milliseconds, they take aprox 1-2 seconds each. I would like to reduce this query time to a few milliseconds like the other entries, but I don't know how. I have tested it with and without ts_rank to find out that ranking only add half a second to the total query, if it even makes a difference. so that's not my problem Some samples queries are: query: result: (cid |name|synonym|tsv vector) query: result: query: result: I wonder what the best way to make this last queries faster would be. I have tried with a pre-processing script that removes all the numbers, it speeds up the search up to 3 seconds in total, but I miss the exact/closest match that I was looking for in some of the cases, so that's no use. Other approaches that came to mind where: I think this could be a potential good solution for me, but as far as I have seen cannot be done. Tsvectors/queries can be labelled, but not token types or IS THERE A WAY TO LABEL TOKENS DIFFERENTLY WITHIN THE SAME TSVECTOR? Same as the parser, it might lead me to wrong matches, although since it keeps the positional information it me perform good. I'm not sure how i should do this though. My postgres.conf parameters: I have tried lower amounts of shared_buffer and effective_cache_size (16GB and 32GB respectively), no difference in performance from the current one, so I'm planing to change it back to those limits I tried a gist index on querytree lexemes, didn't make much difference I'm a little bit lost and I would appreciate any ideas or possible solutions to speed up my queries. Thanks :) PD: Any recommendations for nonSQL DBs that could improve performance? |
Posted: 26 Feb 2013 12:40 PM PST I have a hierarchical query but I don't manage to order it as I want. I have a column named sequence that indicates how to order it but the data is kinda mixed up and I cant do it properly. This a lookalike of the information I have: If I run the query without ordering I end up with information like this: currently I have in place an ORDER BY id, sequence but that sends the second level item of the parent 146 to the last position looking just like the first set of data. is there a way to order it to put that lost node 151 under its parent 146 without messing up all the other information? This is more or less what I need as end result: |
What are the advantages of a database design with single table for MtM relationships? Posted: 26 Feb 2013 10:43 AM PST The database that backs our software product has a table design like the following: From the above example, each That means that if I want to get the The advantages of the current approach are:
The disadvantages of the current approach are:
My questions are:
|
Why is SQL Server memory showing in task manager Posted: 26 Feb 2013 08:11 PM PST I have worked with SQL Server for a while now, and I understand that SQL memory is inaccurately reported by the task manager. However I have recently been doing some testing on SQL Server that someone else has setup. I am expecting to see Is there a setting in SQL Server that is causing the task manager to report this inaccurately? Or is there something going wrong in the background of my SQL Server that is causing it to balloon? |
Is it possible to pipe the result of a mysqldump straight to rsync as the source argument? Posted: 26 Feb 2013 01:56 PM PST Is it possible to pipe the result of a mysqldump straight to rsync as the source argument? Conceptually, I was thinking something like: I've seen people pipe the result to mysql for their one liner backup solution, but I was curious if it was possible with rsync. You know--- cause rsync is magic :) Thanks for your time! |
Posted: 26 Feb 2013 03:49 PM PST Two databases with same structure at least for my eye. One of them was used as training/testing, where I can add list of products in common properties in both DB 999 and DB 000 SET ANSI_NULL_DEFAULT OFF GO SET CURSOR_CLOSE_ON_COMMIT OFF GO SET CURSOR_DEFAULT GLOBAL GO The program generates a error message saying table Art misses index when I use fakt000 as a destination database, while using fakt999 as database I have no problems. I do have checked the table To solve this issue I have rebuilt all the indexes in I do have change the collation to be similar and again rebuilt all indexes in I do have added same tables in fakt000 but not in fakt999 database. I do not think this would cause any of such error, as error states I have ran profiler to see what commands do the program use and where it may have missed, seems too complex to me, I have enlisted it down, I am not sure what to do next? to solve it out. I can insert some products into table using Profiler gives me these codes when it successes in test DB fakt999 NOTE:The program FDT is a ERP software whose source code or support is out of scope. *Edit: Sorry I may have been confused myself in writing the name of table in both databases as products instead of |
Is data retrieved from SQL Server compressed for transmission? Posted: 26 Feb 2013 04:21 PM PST Is data retrieved from Microsoft SQL Server compressed? If this is controlled by the connection string, is there any simple way to tell if any particular app is using it? I'm examining analysis tools, and the volume of data can take minutes to transmit over our network. I'm wondering whether I should expect a performance increase if we pull data from a compressed data store on the same remote server. As long as we're on the topic, I'm curious: is data transmitted in binary or ASCII? For example, if the value To be clear, I understand that there are options regarding storing data with compression, and backing it up. I'm asking about how data is transmitted. |
Can this array group count query be improved? Posted: 26 Feb 2013 06:07 PM PST So I have the following query Gives me the following result: Which is pretty decent I suppose. The previous way of doing things where to have a bunch of join tables and that gave me something like below: Now forget about the last explain and lets focus on the first one. Can it be optimized further? Any tricks or such that I might be missing out on? I guess an index on the user_id column should be plenty for this query? |
Oracle 10g slow performance on first query Posted: 26 Feb 2013 08:28 PM PST We have an application which we recently upgraded and is having bad performance issues. Any ideas would be much appreciated. The main issue is windows taking ages (minutes) to open because the initial query to fill their list boxes is taking so long. The second time a user opens the window its fine. We would expect this to be application cacheing but we don't think so. We see similar problems using Crystal Reports and using command line SQL queries. We have increased the RAM available to the database. Another part of our business has a slightly different version of the same application and database and doesn't get this problem. The time to complete a query can be 30 minutes for the first time in a session and 30 seconds for subsequent executions. |
MySQL Workbench sync keeps requesting the same changes Posted: 26 Feb 2013 04:28 PM PST I am using MySQL Workbench, and when I try to "synchronize" it with my remote database, it keeps detecting some changes to make. Specifically, the most recurrent ones are:
I was compliant and executed all the queries given to me (and added the semi-colon that they forgot). MySQL didn't complain and executed them. However it didn't help, I can run it 20 times in a row, it will still ask the same useless changes. |
Getting max values from MySQL tables Posted: 26 Feb 2013 05:28 PM PST I have three tables:
where: I need a query to select the latest |
Posted: 26 Feb 2013 10:27 AM PST The syntax for rules in SQL Server 2005 is given: Whenever using rule, for example: Why are we using a variable like I just need an explanation for this. I know that rules are now deprecated but I am using SQL Server 2005. |
FLUSH TABLES stays in the processlist even after execution Posted: 26 Feb 2013 06:28 PM PST Here is my code from Stored Procedures in Mysql Then i execute a query to load a file in to database as below I executed this set of code one after the other several times using a Windows service. After some time, the Windows service stops automatically. When I open MySQL Administrator, I could see the |
SQL Server Analysis Studio naive Bayes attribute has too many states Posted: 26 Feb 2013 03:57 PM PST I'm using SQL Server Analysis Studio and I'm trying to train a naive Bayes classifier. I've got an attribute called "item description" that basically represents products you can buy at a store. I've got these products mapped to a code and I want to train a classifier to take products it hasn't seen before and give me the code of highest probability. What I'm running into is that my attribute of "item description" has too many states and so SSAS is throwing away a lot of my items - Analysis Studio says so. I'm got a case table that has an ID and code and a nested table that represents these "item descriptions" chopped up into individual words. Naive Bayes then uses conditional probabilities to map the words to a code. I tinkered with the MAXIMUM_STATES setting and set it to 0 but according to the documentation, it maxes out at 65k. Does anyone know if it's possible to raise this limit some magical way? Or can anyone suggest to me an alternate implementation of a naive Bayes classifier that is more scaleable. |
How could DBAs be more 'programmer friendly'? Posted: 26 Feb 2013 01:57 PM PST The answers and comments on the dba.se version and programmers.se version of the question "What are the arguments against or for putting application logic in the database layer?" are very revealing about the divide between DBAs and programmers in some workplaces. What could DBAs do differently to work better with programmers on issues like this? Should we:
|
You are subscribed to email updates from Recent Questions - Database Administrators - Stack Exchange To stop receiving these emails, you may unsubscribe now. | Email delivery powered by Google |
Google Inc., 20 West Kinzie, Chicago IL USA 60610 |
No comments:
Post a Comment